【发布时间】:2017-06-15 13:30:13
【问题描述】:
我有一个 python 程序,我想从 php 执行我已经尝试过 "exec,escapeshellcmd,shell_exec,passthru,popen" 但没有人给出结果。
我已经成功执行了“hello word”程序,但是我需要的程序没有执行并且没有显示任何错误。
echo $python = exec("python python/interactive.py");//this file not working
echo $python = passthru("python python/python.py ");// this is working with hello world.
$output = shell_exec($command);
echo $output;
【问题讨论】:
-
是的,
exec和朋友是解决这个问题的正确方法。你得到什么错误? -
我没有收到任何错误。
-
你能分享你的 php 代码,至少是你调用
exec的那一行吗? -
我也添加了代码。
-
python/interactive.py在做什么?听起来它需要一个终端,如果您在网络服务器中运行该 python 程序,它当然不存在