1.在php绘图时,往图片中写入中文是成功的,但是显示出来的中文是一些生僻字。
$im = imagecreatetruecolor(400,40);
$black = imagecolorallocate($im,0,0,0);
$white = imagecolorallocate($im,255,255,255);
$grey = imagecolorallocate($im,128,128,128);
imagefilledrectangle($im,0,0,399,39,$white);
$text = mb_convert_encoding("呵呵呵","UTF-8","GBK");
$font = "simsun.ttc";
imagettftext($im,20,0,12,21,$grey,$font,$text);//输出灰色字符串作为阴影
imagettftext($im,20,0,10,20,$black,$font,$text);//输出黑色字符串作为文本
header("Content-type:image/png");
imagepng($im);
imagedestroy($im);
?>
http://www.webyang.net/Html/web/article_263.html
已解决,$text = mb_convert_encoding("呵呵呵","UTF-8","GBK");改成$text = mb_convert_encoding("呵呵呵","html-entities","UTF-8");即可