I have a python script which do some processing over images and gives me text, the script is running fine in the console. Now i want to display the same text by using php in a browser.
When i use the below code, i get the proper values in php variables $f and $v when i exectute the code from console but when i execute the code from browser i don't get any value in php variables
exec('python /var/www/abc/abc.py', $f, $v);
echo $f;
echo $retval;
In python script: I have something like this
code...
code...
......
#in the end
print text
sys.stdout.flush()
How can i get the print values in python script in my php variables??
解决方案
Make sure $f is an array before calling exec(), then print_r($f) should do the trick