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条)

报告相同问题?

悬赏问题

  • ¥30 YOLO检测微调结果p为1
  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题