3
任何人都可以说,为什么下面的代码挂在fwrite($pipes[0], $data);
上,但是当我将$bytesCount
更改为例如1000时,它不会挂起?php - > fwrite处理管道挂起 - >为什么?
我是不是能够通过谷歌找到答案:(
谢谢。
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$bytesCount = 1000000;
$process = proc_open('cat', $descriptorspec, $pipes);
$data = str_repeat('a', $bytesCount);
fwrite($pipes[0], $data);
fclose($pipes[0]);
$response = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$return_value = proc_close($process);
如果你使用带有第三个参数的'fwrite',然后'fflush'这个流,重复这个几次? –
@AurelBílý不,它不) –