Can I call python script or function from php

前端 未结 2 1943
渐次进展
渐次进展 2021-01-06 05:44

I have the php page which lists the backups with filename and username. the backups are done with python script but for web interface I used php.

Now I want to put t

相关标签:
2条回答
  • 2021-01-06 06:31

    Yes you can call exec("python pythonscript.py someparams"); or if you need to save the output to a variable use this code

    exec("python mypythonscript.py someparams",$output);
    var_dump($output);
    

    More informaiton: call python script by php and solve errors

    0 讨论(0)
  • 2021-01-06 06:35

    You can call the shell from PHP:

    • shell_exec()
    • exec()
    • backticks

    and there are more.

    0 讨论(0)
提交回复
热议问题