PHP中重定向网页跳转页面的要领有三种,下面为人人细致引见一下。
第一种:应用header()函数举行重定向,这也是我用的较多的。(注重!location和“:”之间不能有空格,否则无作用!)
<?php header('content-type:text/html;charset=uft-8); //重定向页面 header('location:index.php'); ?>
第二种:应用HTML 头部中的 meta标签,定义http-equiv=refresh 和content=”跳转消费的时候(秒为单元);url=跳转地点”
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> //跳转页面,跳转时候:3秒钟,目的地点:index.php <meta http-equiv="refresh" content="3;url=index.php"> <title>skip...</title> </head>
或许
<?php header('content-type:text/html;charset=utf-8'); $url='index.php'; ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> //跳转页面,跳转时候:2秒钟,目的地点:index.php <meta http-equiv="refresh" content="2;url=<?php echo $url; ?>"> <title>skip...</title> </head>
第三种:应用javascript举行跳转
<?php header('content-type:text/html;charset=utf-8'); $url='index.php'; //马上跳转至目的页面 echo <script>window.location.href='$url';</script>; ?>
以上内容仅供参考!
引荐视频教程:PHP视频教程
以上就是php重定向后跳转不了的细致内容,更多请关注ki4网别的相干文章!