A: Issues to be aware of
1.iis PHP has permission to Python.
2.cmd to owner permissions.
The encoding format in the 3.cmd command line is GBK.
4.exec (), Shell_exec (), System (), PassThru () differences.
5.windows version corresponding to the Python version, I here the company system is very old, encountered a lot of pits.
Two: examples
1. I use this example as an example of PassThru. is also the direct output result.
2. On the PHP source
Header ("Content-type:text/html;charset=utf-8");
Receive the form (here This params is just an example, mainly to let everyone know how to send a reference)
$params = $_post[' params '];
$str = Iconv ("Utf-8", "Gb2312//ignore", $car _card);
Call Python (the full directory is used here)
$common = "D:/python27/python.exe d:/compiled/pingan_data_launch.py $params";
$res = @passthru ("$common", $result);
3. On the Python source
# _*_ Coding:utf-8 _*_
For I in range (10):
A = ' My city '
Print (a)
It's 4.ok.
PHP running Python script under IIS