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

时间:2022-10-20 09:36:10

Hi I just posted this question PHP $_SESSION problem - I am able to log my user into the website/database just fine but instead of having it say "you have logged in, $username" - how can I say "you are logged in, $username" and in 3 seconds the page will redirect else where?

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

Thanks!

4 个解决方案

#1


2  

You could add a meta refresh tag to the header part of the page.

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

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

I would still add a link to go there manually if the page doesn't automatically redirect; Refresh-headers can be disabled.

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

#2


1  

Using the meta HTML tag:

使用元HTML标记:

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

Using Javascript:

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

#3


0  

You would need to echo out a meta tag to refresh the page after a delay, to look something like:

您需要回显一个元标记以在延迟后刷新页面,看起来像这样:

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

Where the 3 is 3 seconds and site.com is the location.

3是3秒,site.com是位置。

#4


0  

Use sleep(3); followed by header("Location:YourLink");

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

The number in sleep is how many seconds to wait before continuing and the header command will redirect you wherever you'd like.

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

Just print out the message to the user before the sleep command and viola.

只需在sleep命令和viola之前将消息打印给用户。

#1


2  

You could add a meta refresh tag to the header part of the page.

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

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

I would still add a link to go there manually if the page doesn't automatically redirect; Refresh-headers can be disabled.

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

#2


1  

Using the meta HTML tag:

使用元HTML标记:

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

Using Javascript:

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

#3


0  

You would need to echo out a meta tag to refresh the page after a delay, to look something like:

您需要回显一个元标记以在延迟后刷新页面,看起来像这样:

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

Where the 3 is 3 seconds and site.com is the location.

3是3秒,site.com是位置。

#4


0  

Use sleep(3); followed by header("Location:YourLink");

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

The number in sleep is how many seconds to wait before continuing and the header command will redirect you wherever you'd like.

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

Just print out the message to the user before the sleep command and viola.

只需在sleep命令和viola之前将消息打印给用户。