index.php代码如下
<?php
$id = $_GET['id'];
$fh = fopen('http://abc.com/'.$id.'.txt', 'r');
if($mb){
while(!feof($mb)) {
echo fgets($mb);
}
}
?>
访问时如果xx不存在显示的是报错:
Warning: fopen(http://abc.com/xx.txt): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /www/wwwroot/abc.com/index.php on line 3
怎么弄成如果xx不存在显示指定内容,比如显示404页或跳转到指定url?