查询语言.forceIndex

函数原型

  1. public function forceIndex($mixIndex, $sType = 'FORCE');
  2. public function ignoreIndex($mixIndex);

用法如下

  1. # SELECT `test`.* FROM `test` FORCE INDEX (nameindex,statusindex) IGNORE INDEX (testindex) WHERE `test`.`id` = 5
  2. Db::table('test')->
  3. forceIndex('nameindex,statusindex')->
  4. ignoreIndex('testindex')->
  5. where('id', '=', 5)->
  6. getAll();