Home >Backend Development >PHP Tutorial >Example of using GD to output Chinese characters in PHP_PHP tutorial
//Define the output as image type
header("content-type:image/gif");
//New image
$pic=imagecreate(240,30);
//Define black and white color
$black=imagecolorallocate($pic,0,0,0);
$white=imagecolorallocate($pic,255,255,255);
//Define font
$font="c://WIN2000//fonts//simhei.ttf";
//Define output font string
$str = chr(0xE8).chr(0xB5).chr(0x9B).chr(0xE8).chr(0xBF).chr(0xAA).chr(0xE7).chr(0xBD).chr(0x91)." http ://www.itbbs.cn";
//Write TTF text into the picture
imagettftext($pic,12,0,10,20,$white,$font,$str);
//Create GIF graphics
imagegif($pic);
//End graphics and release memory space
imagedestroy($pic);
?>