尝试在 PHP 中启动外部程序 (.hta) 文件
对于一个学校项目,我编写了一个网络应用程序来拍照(使用相机)并对其进行一些分析。我下载了一个名为 DIYPhotoBits (capture.hta) 的工具,它可以远程触发相机快门,我正在尝试用 php 启动它。问题是,以下命令都不起作用。服务器就像在等待一样挂起。错误日志没有显示任何内容。如果我在 Windows 资源管理器中输入下面的路径,程序就可以正常运行。
有谁知道为什么?太感谢了。
popen('C:/Users/Nick/Documents/Webpages/microplate/executables/capture.hta', 'r');
exec('C:/Users/Nick/Documents/Webpages/microplate/executables/capture.hta');
system('C:/Users/Nick/Documents/Webpages/microplate/executables/capture.hta');
passthru('C:/Users/Nick/Documents/Webpages/microplate/executables/capture.hta');
For a school project, I've written a webapp to take a picture (using a camera) and do some analysis on it. There is a tool I downloaded called DIYPhotoBits (capture.hta) which remotely fires the camera shutter, and I am trying to start it with php. The problem is, NONE of the below commands work. The server just hangs like it's waiting. Error logs reveal nothing. If I enter the path that is below into Windows Explorer, the program runs just fine.
Does anyone know why? Thank you so much.
popen('C:/Users/Nick/Documents/Webpages/microplate/executables/capture.hta', 'r');
exec('C:/Users/Nick/Documents/Webpages/microplate/executables/capture.hta');
system('C:/Users/Nick/Documents/Webpages/microplate/executables/capture.hta');
passthru('C:/Users/Nick/Documents/Webpages/microplate/executables/capture.hta');
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请原谅我是一个批处理新手,但是您是否尝试过通过在路径之前添加“start”命令来启动程序?我一直在尝试使用您给 PHP 的命令启动一个可执行文件,但没有成功。
另外,您的 .hta 扩展名是否分配了一个程序来打开它......?
Forgive me for being a batch newbie, but have you tried starting the program by prefixing the 'start' command before the path? I've been trying to start an executable file with the command you've given to PHP, unsuccessfully.
Also is your .hta extension assigned a program to open it with..?
尝试使用 shell_exec() 函数或反引号运算符 (``)
Try the
shell_exec()
function or the backtick operators (``)