fsockopen 异步不已,求大侠

WBOY
Release: 2016-06-13 11:33:20
Original
817 people have browsed it

fsockopen 异步不了,急求大侠

<?php<br />$fp = fsockopen("127.0.0.1", 80, $errno, $errstr, 30);<br />if (!$fp) {<br />    echo "$errstr ($errno)<br />\n";<br />} else {<br />    $out = "GET /public/b.php HTTP/1.1\r\n";<br />    $out .= "Host: 127.0.0.1\r\n";<br />    $out .= "Connection: Close\r\n\r\n";<br />    fwrite($fp, $out);<br />     while (!feof($fp)) {<br />         echo fgets($fp, 128);<br />     }<br />    fclose($fp);<br />}<br />?>
Copy after login

我这样确实访问了b.php,并获取到了b.php echo出的内容

但我为的是异步不关心结果,获得结果就不是异步了我就把上面代码的
 while (!feof($fp)) {
         echo fgets($fp, 128);
     }去掉了

但这样就死活没有发送请求到b.php了
b.php:
file_put_contents('log.txt','bbbbbbbbbbbbbbbbbbb11');
?>

我就香发个请求过去,不返回结果继续往下走,怎么这样就不行呢

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template