ThinkPHP以及原生SQL查询的ID在一个数组中的查询

{{ time }}

ThinkPHP中, 示例代码如下

$mobileId=[1,3,5,6,7,8];
$mobileRec=db('product')
           ->where('id','in',$mobileId)
           ->select();

原生SQL, 示例代码如下

select * from product where id in (6,7,8,9,10,11,12);