This is the php code
<code><?php system('python E:\WEB\Python\py\learn\php_get_python.py'); </code>
The following is the python code
<code># -*- coding: utf-8 -*- import sys def php_get_python(): print u'hello world 这里php就调用了.py文件' if __name__ == '__main__': php_get_python()</code>
ps: I am using phpstudy to configure the environment under windows
This is the php code
<code><?php system('python E:\WEB\Python\py\learn\php_get_python.py'); </code>
The following is the python code
<code># -*- coding: utf-8 -*- import sys def php_get_python(): print u'hello world 这里php就调用了.py文件' if __name__ == '__main__': php_get_python()</code>
ps: I am using phpstudy to configure the environment under windows
system('E:WEBPythonpylearnphp_get_python.py'); Execute directly like this