先列下目标sql语句
SELECT * FROM `table` WHERE `id` IN (423603,423605,423606) ORDER BY FIELD(`id`, 423603,423606,423605)
where id in (1,2,3) 这个条件按以下代码写即可
$query->where('id', 'in', $list_str);
但后面的order实现有些麻烦,找了一圈,可以按如下实现
$list_str = implode(",", $array); $exp =new \think\db\Expression('field(id,'.$list_str.')'); $query = $query->order($exp);