对于CakePHP版本2.x. 如果$ trs是用户标识的数组,则不必将IN关键字置于条件中.您可以只将数组("Post.user_id"=> $ trs)和Cake添加IN运算符留给此查询.全线:
$ this-> Post-> find('all',array('conditions'=> array('Post.user_id'=> $ trs),'order'=> array('Post.created DESC')));
php sql cakephp
cakephp ×1
php ×1
sql ×1