Heim > Artikel > Backend-Entwicklung > php 弹框
if($mail -> Send()){ echo "<script>alert('Success')</script>"; header("Location: homeConnect.php");}else{ echo "<script>alert('Failed')</script>"; header("Location: homeConnect.php");}
要改成这样的
echo "<script>alert('Failed')</script>";
echo "<script>location: homeConnect.php</script>";
header("Location: homeConnect.php");
在 http 头中产生跳转指令,所以跳转发生于脚本执行之前
要改成这样的
echo "<script>alert('Failed')</script>";
echo "<script>location: homeConnect.php</script>";
header("Location: homeConnect.php");
在 http 头中产生跳转指令,所以跳转发生于脚本执行之前
echo "<script>location.href= 'homeConnect.php';</script>";
用script跳转