Page redirect after certain time PHP(一定时间后页面重定向 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:一定时间后页面重定向 PHP
基础教程推荐
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- php中的foreach复选框POST 2021-01-01
- Web 服务器如何处理请求? 2021-01-01
- 将变量从树枝传递给 js 2022-01-01
- php中的PDF导出 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
