打算登录失败后,弹出一个登录失败的对话框,再跳转到主页。可是按照下面代码执行之后,不会弹出提示,就直接进入主页了;去掉header那句话,就可以弹出提示。请问各位高手有什么办法实现小弟需要的功能?不胜感激!<?php
echo "<script language=javascript>alert(\"Login failed!\");</script>";
header("Location:index.php");
?>
echo "<script language=javascript>alert(\"Login failed!\");</script>";
header("Location:index.php");
?>
printf("<script language=javascript>alert('Login failed!');window.location.href = %s;</script>",$url);
window.location.href = 'index.php';
可采用4楼的方法