简体   繁体   English

在服务器上使用php执行python程序

[英]Execute python program using php on server

I have a python program that i want to execute from php I already tried "exec,escapeshellcmd,shell_exec,passthru,popen" but no one is giving result. 我有一个想从php执行的python程序,我已经尝试过“ exec,escapeshellcmd,shell_exec,passthru,popen”,但是没有人给出结果。

i already execute "hello word" program successfully but the program that i needed is not executing and not displaying any error. 我已经成功执行了“ 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;

如果您想在网络上执行python脚本,我建议您研究一下FlaskDjango之类的python网络框架,这是最好的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM