我有一个php文件。在其中我想要一个像这样的错误重定向:
<?php
$ponka = somerandomsite.com;
if (1=1)
{echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://$ponka/error.php">'}
?>
我怎样才能实现它?
答案 0 :(得分:2)
你php
包含很多错误,这是一个工作样本
<?php
$site = $_GET['site'] // will get the variable $site form a url like script.php?site=somerandomsite.com
$ponka = "somerandomsite.com";
if ($site == $ponka){
echo "<META HTTP-EQUIV='Refresh' Content='0; URL=http://$ponka/error.php'>";
}
?>
此外,请将php
视为名为header的函数
<?php
$site = $_GET['site'] // will get the variable $site form a url like script.php?site=somerandomsite.com
$ponka = "somerandomsite.com";
if ($site == $ponka){
header("Location: http://$ponka/error.php");
}
?>