How to call a Python Script from PHP?

后端 未结 4 1985
[愿得一人]
[愿得一人] 2020-12-01 10:02

I have some code written in PHP, but I have also developed a script written in Python. Is it possible to call this Python script from the PHP code?

If yes, how can I

4条回答
  •  借酒劲吻你
    2020-12-01 10:41

    You use the system function: http://php.net/manual/en/function.system.php

    Something like this:

    $mystring = system('python myscript.py myargs', $retval);
    

提交回复
热议问题