How to call a Python Script from PHP?

后端 未结 4 1994
[愿得一人]
[愿得一人] 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:26

    You can try this:

    python scripts:

     test.py:
            print "hello"
    

    then php Scripts

    index.php:
       $i =`python test.py`;
       echo $i;
    

提交回复
热议问题