php中函数imagestringup显示汉字乱码问题!

来源:互联网 发布:男生不主动追女生知乎 编辑:程序博客网 时间:2024/05/20 17:24

Header("Content-type: image/PNG");
$im = imagecreate(300,50);
$bkg = ImageColorAllocate($im, 128,64,225);
$clr = ImageColorAllocate($im, 255,255,255);
$fnt = "c:/windows/fonts/simfang.ttf"; // ttf字库的绝对路径
$str = iconv("GB2312","UTF-8","欢迎光临"); // 转换成utf-8编码,需加载iconv函数库。PHP ver >= 4.3.0
ImageTTFText($im, 20, 0, 30,40, $clr, $fnt, $str);
ImagePNG($im);
ImageDestroy($im);

原创粉丝点击