'1','info'=>'身份证号码有误')); die; } if(!$name||!$id_type||!$id_num){ echo json_encode(array('code'=>'1','info'=>'请填写完整信息')); die; } $sql = "update wechat_customer set name = '".$name."',id_type = '".$id_type."', id_num = '".$id_num."' where id =".$_POST['id']; $rs_u = $pdo->exec($sql); if(isset($rs_u) && !$rs_u){ echo json_encode(array('code'=>'0','info'=>'信息修改')); die; }else{ echo json_encode(array('code'=>'0','info'=>'信息已修改')); die; } }else{ $sql = "select id,name,id_type,id_num from wechat_customer where id ='".$id."'"; $rs = $pdo->query($sql); $rowset = $rs->fetchAll(PDO::FETCH_ASSOC); if(isset($rowset[0])){ echo json_encode(array('code'=>'0','info'=>'0','list'=>$rowset[0])); }else{ echo json_encode(array('code'=>'1','info'=>'未找到此条信息')); } }