【发布时间】:2013-01-04 18:41:14
【问题描述】:
下午!我正在尝试检查从 post 变量接收到的 URL 是否存在,以及它是否确实将用户发送到那里。如果不重定向到其他地方......我写了这个但由于某种原因不起作用,
有什么想法吗? 干杯
<?php>
$file = $_POST["code"];
$file_headers =
@get_headers('http://example.co.uk/' $file);
if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
/* does not exist
header('Location: http://example.co.uk/?exists=false');
echo $file 'not found';
}
else {
/* exists
header('Location: http://example.co.uk/' $file);
echo $file 'found';
};
?>
【问题讨论】:
-
请发布没有语法错误的代码,除非您询问错误消息本身。感谢您选择搭乘我们的航班。