奇怪的问题,我正在打开一个与fsockopen()
页面的连接,该页面有一个header(location:xx)
到同一页面(我只是刷新脚本),但似乎重定向不起作用......
如果我用浏览器复制它,显然一切正常......
一些代码:
连接页面:
$socketcon = fsockopen($_SERVER['HTTP_HOST'],80,$errorno,$errorstr,10);
if($socketcon) {
$socketdata = "GET http://www.example.com/test2.php HTTP/1.0\r\nHost: ".$_SERVER['HTTP_HOST']."\r\nConnection: Close\r\n\r\n";
fwrite($socketcon,$socketdata);
fclose($socketcon);
}
连接页面(test2.php):
<?
//other code (working fine)
if($_GET["AAA"]){
//REDIRECT WORKED !
} else {
header("location:test2.php?AAA=1"); //same page but with a get param
}
?>
REDIRECT WORKED 部分永远不会被执行......
有什么建议么 ?
编辑:连接必须是异步的