: PHP calls the python script to implement the python function: I need to use php to call the pythonPIL function and paste the text to the image. So use the exec function in php. Add 2 & gt; & 1 after the first parameter in exec. If a python running error occurs, the error information is passed to the $ arr variable. then, the arr variable can be output to the web end for errors. & 1 I need to use php to call the python PIL function and paste the text to the image.
So use the exec function in php.
Add 2> & 1 after the first parameter in exec. If a python running error occurs, the error information is passed to the $ arr variable. then, the arr variable value can be output to the web end for errors.
& 1 ", $ arr, $ ret); print ("
"); Print_r ($ arr); print ("
"); Echo"
". $ Ret ."
";?>
Because I call the Image. TrueType function in python to obtain the font, the _ imaging C module error in python PIL error is returned. I had to uninstall all the previous PIL libraries first, and then install the PIL Library on mac according to this article, and reinstall the PIL library again.
The above describes how PHP calls the python script to implement the python function, including some content, and hopes to help friends who are interested in the PHP Tutorial.