Rumah > Artikel > pembangunan bahagian belakang > php js 跳转不了是为什么阿
php
<code>function alert_go($msg,$url){ echo "<script language="javascript" type="text/javascript">"; echo "window.location.href='$url'"; echo "alert('$msg')"; echo "</script>";}$username=$_POST['username'];$pass=$_POST['pass'];$pass2=$_POST['pass2'];$email=$_POST['email'];if(!filled_out($_POST)){ echo "信息不全,不能录入!"; exit;}if(!valid_email($email)){ echo "邮箱格式不正确,请重新检查!"; exit;}if($pass != $pass2){ echo "两次密码不一致,请重新输入"; exit;}if((strlen($pass)16)){ echo "密码长度不正确,请重新输入"; exit;}//echo "注册成功"; @ $db=new mysqli('localhost','root','020310','demo'); if(mysqli_connect_errno()) { echo "数据库连接错误,请检查后重新连接"; exit; } $query="insert into user(username,password,email) values(?,?,?)"; $stmt=$db->prepare($query); $stmt->bind_param('sss',$username,$pass,$email); $ss=$stmt->execute(); if($ss) { alert_go('注册成功!','http://baidu.com'); //header('Location: http://localhost/login/login.html'); }else{ alert_go('注册失败!','http://baidu.com'); } 为什么最后跳转不到百度页面啊</code>