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
基础教程推荐
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何替换eregi() 2022-01-01
