如何在PHP中从一个页面重定向到另外一个页面呢?这里列出了三种办法,供参考。
如何在PHP中从一个页面重定向到另外一个页面呢?这里列出了三种办法,供参考。
一、用HTTP头信息
也就是用PHP的HEADER函数。PHP里的HEADER函数的作用就是向浏览器发出由HTTP协议规定的本来应该通过WEB服务器的控制指令,例如声明返回信息的类型("Context-type: xxx/xxx"),页面的属性("No cache", "Expire")等等。
用HTTP头信息重定向到另外一个页面的方法如下:
if (isset($url))
{
Header("HTTP/1.1 303 See Other");
Header("Location: $url");
exit; //from www.jzxue.com
}
?>
注意一下,"Localtion:"后面有一个空格。
二、用HTML标记
用HTML标记,就是用META的REFRESH标记,举例如下:
if (!isset($url)) exit;?>
";
echo "location.href='$url'";
echo "īpt>-->";
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools