douding6266 2018-01-07 21:30
浏览 91
已采纳

在Windows网络驱动器上使用php exec(),无需等待或超时

I have searched extensively to solve the issue of opening an external program in phpdesktop without PHP waiting ultimately making PHP timeout.

I need to be able to launch the program with exec() and have the rest of the PHP code execute without waiting on the exec() command. I have tried multiple solutions. To make matters even more complicated the file that is being opened is on a networked drive. Here is what I have tried but has not worked

pclose(popen('start' .$File. '>NUL 2>NUL"', 'r'));   This didn't work because the drive is on the network

exec($File);              Doesn't work as it waits instead of executing the remainder of the code

system($File);            Doesn't work. Same result as exec()

exec($File > /dev/null);  Obviously doesnt work because php is on windows

The file being executed is a video file: mp4, avi or mkv. So it's opening the external video player file but like I said above PHP ultimately times out and gives an error after 30 seconds without executing the rest of the code. I just need PHP to ignore the program it opened and go on about its tasks. Any help would be greatly appreciated.

  • 写回答

2条回答 默认 最新

  • dongwen9975 2018-01-30 00:14
    关注

    You could use something like "nircmd" which is a windows command-line utility to perform tasks and is a perfect fit for php-desktop. You can use the variety of "exec" actions "nircmd" has, so you could call whatever you want and immediately return to php. See the manual (.chm archive), under windows 7/10 you might have to "unblock" that help file (at file properties), to view the contents.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大