如何一次执行多个 shell_exec?
另外,如何切换每个进程以查看 test.php 文件的输出?我需要知道每个进程(php 文件)在做什么。
看一下,例子:
索引.php
<?php
shell_exec("php test.php");
shell_exec("php test.php");
shell_exec("php test.php");
?>
这并不像我想的那样工作,首先必须先完成 shell_exec (test.php),然后它会转到下一个 shell_exec。
测试.php
<?php
$section = rand(123,123);
$x = 1;
while($x <= 50) {
print $section . ": " . $x . "\n";
$x++;
sleep(1);
}
?>
执行 shell_exec 时它不会输出,但是当我php test.php
在 shell 中手动键入时,它会输出。
或者有没有办法打开多个shell?
这是一个简单的示例,但是我将执行多个 PHP 文件来运行 CURL