DB登录后,重定向到另一个页面

时间:2011-07-25 17:51:26

标签: php mysql database

您好我刚刚发布了这个问题PHP $_SESSION problem - 我能够将我的用户登录到网站/数据库中,但是没有说“您已登录,$ username” - 我怎么能说“你已登录,$ username“并在3秒内页面将重定向到其他位置?

谢谢!

4 个答案:

答案 0 :(得分:2)

您可以将元刷新标记添加到页面的标题部分。

<meta http-equiv="refresh" content="3;url=http://domain.com/other.php"> 

如果页面没有自动重定向,我仍会手动添加链接去那里;可以禁用刷新标头。

答案 1 :(得分:1)

使用meta HTML标记:

<meta http-equiv="refresh" content="3;url=http://domain/"> 

使用Javascript:

function redirect(url) {
  document.location(url);
}
setTimeout('redirect("http://domain/")',3000)

答案 2 :(得分:0)

您需要在延迟后回显元标记以刷新页面,如下所示:

<meta http-equiv="refresh" content="3;url=http://site.com/">

3为3秒且site.com为位置。

答案 3 :(得分:0)

使用sleep(3);然后是标题(“Location:YourLink”);

睡眠中的数字是在继续之前等待的秒数,并且header命令会将您重定向到您想要的任何位置。

只需在睡眠命令和中提琴之前将消息打印给用户。

相关问题