PHP calls the python script to implement the python function

Source: Internet
Author: User
: 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.