reg.html
ajax
user.php
exec("set names utf8"); $uname = $_REQUEST["uname"];//post传值,这里要改为REQUEST $sql = "select * from stu_info where sname='".$uname."'"; $data = $pdo->query($sql)->fetch(PDO::FETCH_ASSOC); if($data){ $list['status']=1; $list['info']="已经注册"; $list['data']=$data; echo json_encode($list); }else{ $list['status']=0; $list['info']="未注册"; $list['data']==""; echo json_encode($list); }?>