-2

php代码:

<?php
   exec("C:/Python27/python qwer.py 2>&1", $output);
   print_r($output);
?>

Python代码:

f = open('myfile.txt','w')
f.write('hi there\n')

错误:

Array ( [0] => C:/Python27/python: can't open file 'qwer.py': [Errno 2] No such file or directory )
4

1 回答 1

1

给出 qwer.py 的完整路径,如下所示

<?php
   exec("C:/Python27/python c:/scripts/qwer.py 2>&1", $output);
   print_r($output);
?>
于 2013-07-02T11:26:01.750 回答