PHP generation of Chinese verification code garbled problem solution (1/2) _ PHP Tutorial

Source: Internet
Author: User
PHP generates Chinese verification code garbled problem (12 ). PHP generates Chinese verification code garbled problem solve the problem of Chinese characters to be processed, first convert UTF8 Chinese characters into html entities and then use. example code: ini_set (JIS-mappedJapaneseFontSupport PHP to generate Chinese verification code garbled problem solved
// The Chinese character to be processed, which is converted from the UTF8 Chinese character to the html entity before being used.

// Sample code:

// Ini_set ('jis-mapped Japanese Font Support ', false );
$ Pic = imagecreate (250,30 );
$ Black = imagecolorallocate ($ pic, 0, 0 );
$ White = imagecolorallocate ($ pic, 255,255,255 );
$ Font = "C: // WINDOWS // Fonts // simhei. ttf ";

$ Str = 'People's Republic of China ';
$ Str = mb_convert_encoding ($ str, "html-entities", "UTF-8"); // result: Which team takes the lead?

Imagettftext ($ pic, 10, 0, 10, 20, $ white, $ font, $ str );

Header ("Content-type: image/jpeg ");
$ Filename = './photo.jpg ';
$ Im = imagecreatefromjpeg ($ filename );
Imagecopymerge ($ im, $ pic, 50 );
Imagejpeg ($ im );


// PChart sample code:

/*
Example14: A smooth flat pie graph
*/1 2

Http://www.bkjia.com/PHPjc/632369.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632369.htmlTechArticlePHP to generate Chinese verification code garbled problem solution // to be processed Chinese characters, first from UTF8 Chinese characters into html entity form and then use. // sample code: // ini_set ('jis-mapped Japanese Font Support '...

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.