PHP中重定向网页跳转页面的方法有三种,下面为大家详细介绍一下。
第一种:利用header()函数进行重定向,这也是我用的较多的。(注意!location和“:”之间不能有空格,否则无作用!)<?php header('content-type:text/html;charset=uft-8); //重定向页面 header('location:index.php'); ?>
第二种:利用HTML 头部中的 meta标签,定义http-equiv=refresh 和content=”跳转花费的时间(秒为单位);url=跳转地址”
//跳转页面,跳转时间:3秒钟,目标地址:index.php skip...或者<?php header('content-type:text/html;charset=utf-8'); $url='index.php'; ?>
//跳转页面,跳转时间:2秒钟,目标地址:index.php skip...第三种:利用javascript进行跳转<?php header('content-type:text/html;charset=utf-8'); $url='index.php'; //立即跳转至目标页面 echo
以上内容仅供参考!
推荐视频教程:PHP视频教程