Home  >  Article  >  Backend Development  >  PHP页面实现定时跳转的方法

PHP页面实现定时跳转的方法

PHP中文网
PHP中文网Original
2017-03-21 13:54:141453browse

本文实例讲述了PHP页面实现定时跳转的方法,分享给大家供大家参考。具体实现方法如下:

php定时跳转我们需要利用header函数输入html或js代码来实现定时跳转,下面我来介绍一个简单的例子

php代码如下:

header("refresh:3;url=//m.sbmmt.com");
print('正在加载,请稍等...
三秒后自动跳转到php中文网~~~');

输出的html代码就是

一样的效果。
这样就实现了3秒之后自动跳转到//m.sbmmt.com了。

这里需要注意的是:如果你文件是uft-8编码的话我们要注意不要在header前有输出或BOM字符,这可会导致无法跳转。

希望本文所述对大家的PHP程序设计有所帮助。

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