Rumah > Artikel > pembangunan bahagian belakang > php查询条件为一维数组
PHP查询条件where id = array(1,2,3)怎么做
where id in (1,2,3)
$id = implode(',', array(1,2,3));
$sql = "....where id in ($id) ";
使用in可以
$id = array(1,2,3);$sqlstr = "select * from table where id in(".implode(',',$id).")";