How to get print values ​​in python script in php variables in php script?

I have a python script that does some processing on images and gives me text, the script works fine in the console. Now I want to display the same text using php in a browser.

When I use the code below, I get the correct values ​​in the php variables $ f and $ v when I explicate the code from the console, but when I execute the code from the browser, I don't get any value in the 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 to get print values ​​in python script in my php variables?

+4
source share
1 answer

Make sure $f is an array before calling exec() , then print_r($f) should do the trick

+4
source

Source: https://habr.com/ru/post/1392335/


All Articles