Home >Backend Development >PHP Tutorial >PHP utf8 page verification code picture Chinese garbled_PHP tutorial
During development, the Chinese verification code on the uft-8 page appeared garbled. I found the reason by searching on Baidu. There are solutions below for friends in need to refer to.
The code is as follows
|
Copy code
|
||||||||
session_start();
|
for($i=0;$i<4;$i++){
for($i=0;$i<200;$i++){ imagesetpixel($im,rand()%100,rand()%30,$te2);
The code is as follows | Copy code | ||||
$str=iconv("gbk","utf-8","Happy New Year!");//Determine the Chinese text to be drawn
imagettftext($im,12,3,20,20,$te,'msyhbd.ttf','中文en');
-->>
It should be like this
|