Home >Backend Development >PHP Tutorial >No response when php calls python

No response when php calls python

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-08-04 09:20:511905browse

In the php file, I tried to use system() to call a .py file. Why didn’t it happen?

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

Reply content:

In the php file, I tried to use system() to call a .py file. Why didn’t it happen?

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn