Home  >  Article  >  php教程  >  PHP页面实现定时跳转的方法

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

WBOY
WBOYOriginal
2016-06-06 20:18:48952browse

这篇文章主要介绍了PHP页面实现定时跳转的方法,实例演示使用header函数来实现跳转的技巧,需要的朋友可以参考下

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

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

php代码如下:

复制代码 代码如下:

header("refresh:3;url=http://www.jb51.net");
print('正在加载,请稍等...
三秒后自动跳转到脚本之家~~~');


输出的html代码就是

复制代码 代码如下:

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

这里需要注意的是:如果你文件是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