<?php $arr = $_POST["item"]; $db = new mysqli("localhost","root","12345678","heiheihei"); //foreach($arr as $v) //{ // $sql = "delete from contacts WHERE id='{$v}'"; // $db->query($sql); //} $str = implode("','",$arr);//拼接字符, $sql = "delete from contacts WHERE id in('{$str}')"; //2','8','4 if($db->query($sql))//判断是否查询成功, { header("location:shouye.php"); //成功就跳转 } ?>