一定时间后页面重定向 PHP [英] Page redirect after certain time PHP

查看:28
本文介绍了一定时间后页面重定向 PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个特定的 PHP 函数可以在一段时间后进行重定向.我在哪儿见过,但想不起来了.就像登录后的gmail重定向一样.请问有谁可以提醒我一下吗?

There is a certain PHP function for redirecting after some time. I saw it somewhere but can't remember. It's like the gmail redirection after logging in. Please, could anyone remind me?

推荐答案

header( "refresh:5;url=wherever.php" );

这是设置 header 的 php 方式,它将在 5 秒

this is the php way to set header which will redirect you to wherever.php in 5 seconds

请记住,header() 必须在发送任何实际输出之前调用,无论是通过普通的 HTML 标记、文件中的空行还是来自 PHP.使用包含或要求函数或其他文件访问函数读取代码,并且在调用 header() 之前输出空格或空行,这是一个非常常见的错误.使用单个 PHP/HTML 文件时存在同样的问题.(来源 php.net)

Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. (source php.net)

这篇关于一定时间后页面重定向 PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆