我试图运行我的phantomjs脚本,像4个线程/进程。这个想法是用不同的参数异步运行它。 因此Im做这样的事情(在一个循环中):多个system()调用是否在不同的线程/进程中工作?
$arguments = array('argument1', 'argument2', 'argument3');
foreach($arguments as $argument){
system('phantomjs my_script.js ' . $argument . ' > output_for_' . $argument . ' 2> errors_for_' . $argument . ' &');
}
将phantomjs实例asynchronnously工作?或不 ?我知道这是非阻塞系统调用,并且php脚本继续执行 - 但我不知道每个由php system()调用的phantomjs实例是否与另一个phantomjs实例异步。
为什么不简单地使用线程而不是你认为可能是线程的东西? – 2014-09-03 07:59:27
据我所知,php不支持线程。我对么 ? @ N.B – user1652792 2014-09-03 08:03:14
看看http://php.net/pthreads – 2014-09-03 08:13:31