Home >Backend Development >PHP Problem >How to implement timed jump in php header

How to implement timed jump in php header

青灯夜游
青灯夜游Original
2021-02-26 17:57:002358browse

php method to implement timed jump: first create a PHP file; then use the "header('Refresh: time value, Url=url page address');" code, for example "header('Refresh :3,Url=hello.php');" means the page will jump after 3 seconds.

How to implement timed jump in php header

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

php header timing jump

header('Refresh:time,Url=url页面地址');

Example:

header('Refresh:3,Url=http://www.php.cn/');   //3s后跳转
echo '3s 后跳转';
//由于只是普通页面展示,提示的样式容易定制
die;

php header jumps to the page immediately

header('Location:url页面地址');

[Recommended learning: "PHP video tutorial 》】

Note:

1. There cannot be a space between location and ":", otherwise an error will occur.

2. There cannot be any output before using the header.

3. The PHP code after the header will also be executed.

For more programming related knowledge, please visit: Programming Video! !

The above is the detailed content of How to implement timed jump in php header. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn