dtqpw68806 2015-09-02 14:51
浏览 9
已采纳

在for循环中执行 - 执行多个实例

How can you run multiple exec instances from a for loop and run them separately (i.e. not have one dependent on another finishing before starting another)? I have the following code which is hopefully self explanatory:

for ($i = 0;$i < 5;$i++){
    exec('START '.$path.' '.PATH.'spawn.php "'."$type,$core".'"');
}

I have looked at php in background exec() function but it isn't a duplicate as I am using the START command and adding an & did not fix it.

I have tried /B as an option but additionally this didn't work - it just ran it in the background.

  • 写回答

1条回答 默认 最新

  • doutan2111 2015-09-02 15:28
    关注

    Under windows you will need to do it a bit differently.

    $runCommand = 'calc.exe';
    $WshShell = new COM("WScript.Shell");
    $oExec = $WshShell->Run($runCommand, 7, false);
    

    This should help explain it http://www.somacon.com/p395.php

    http://de2.php.net/manual/en/function.exec.php#43917

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用C语言实现语音的读取及播放
  • ¥15 poi怎么在指定位置之后生成多个表格
  • ¥15 nginx在location设置了client_max_body_size依旧报错413
  • ¥15 C#添加WCF服务引用客户端调用方法没有反应
  • ¥15 stm32f103c8t6与esp8266
  • ¥15 使用Hadoop的MapReduce program
  • ¥15 Python发生IndexError错误如何解决?
  • ¥15 如何用matlab搭建激光器
  • ¥15 51单片机两路互补SPWM输出全桥逆变
  • ¥15 outlook左边用户名下拉为啥打不开了