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 '...