No response when php calls python

WBOY
Release: 2016-08-04 09:20:51
Original
1844 people have browsed it

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>
Copy after login
Copy after login

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>
Copy after login
Copy after login

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>
Copy after login
Copy after login

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>
Copy after login
Copy after login

ps: I am using phpstudy to configure the environment under windows

system('E:WEBPythonpylearnphp_get_python.py'); Execute directly like this

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template