正如问题中的find()方法有什么方法可以使用MySQL
WHERE...IN
条件。例如:
SELECT * FROM `table` WHERE `id` IN (1,2,3);
最佳答案
是的,只需像这样使用条件=>数组(字段=>数组(值))
$conditions = array ( 'Model.field' => array (1,2,3,4) );
$this->Model->find('all', array('conditions' =>$conditions) );
这将执行像这样的 WHERE 条件
SELECT ....
FROM ...
WHERE "Model".field IN (1,2,3,4);
关于mysql - CakePHP,find() 方法中是否有任何方法可以使用 MySQL WHERE...IN 条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9195558/