Running a Python script from PHP

后端 未结 9 1977
鱼传尺愫
鱼传尺愫 2020-11-22 00:57

I\'m trying to run a Python script from PHP using the following command:

exec(\'/usr/bin/python2.7 /srv/http/assets/py/switch.py arg1 arg2\');

H

9条回答
  •  有刺的猬
    2020-11-22 01:32

    To clarify which command to use based on the situation

    exec() - Execute an external program

    system() - Execute an external program and display the output

    passthru() - Execute an external program and display raw output

    Source: http://php.net/manual/en/function.exec.php

提交回复
热议问题