输出中文字符
要想在图形中输出中文字符,需要对输出的中文字符进行编码。使用iconv()函数,可以把一种编码的字符,转换为其他编码的字符。下面介绍在图形中输出中文字符的方法,
<?php
//创建一个新图形
$image = imagecreate(400,200);
//设置背景,分配颜色
$bgColor = imagecolorallocate($image,250,250,250);
$black = imagecolorallocate($image,0,0,0);
//指定imagettftext()函数使用的字体
$font = “simhei.ttf”;
//字义要输出的中文字符串
$string = “这是中文字符串”;
//对中文字符进行编码
$codeString = iconv(“GB......
阅读全文