【发布时间】:2021-07-05 00:37:22
【问题描述】:
我有一个面具检测 python 程序。每当我们运行它时,它都会持续运行并不断检测(无休止的程序)。我已经制作了一个门户网站,以使用 php 在按钮单击事件上启动这个 python 程序。现在的问题是,当我通过 shell_exec() 启动这个程序时,它就会启动。但是 php 等待程序完成。直到程序运行时(从 shell_exec() ),php 只是冻结,甚至不加载任何其他页面。
那么如何从 shell_exec() 运行 cmd 命令而不是等待它完成执行呢?
代码
$command = escapeshellcmd("start cmd /c python mask_detector.py " );
$output = shell_exec($command);
【问题讨论】:
标签: python php stdout stdin stderr