在gd中输出汉字要用ImageTTFText函数
例:
Header("Content-type: image/PNG"); 
$im = imagecreate(300,50); 
$bkg = ImageColorAllocate($im, 128,64,225); 
$clr = ImageColorAllocate($im, 255,255,255); $fnt = "simfang.ttf";
$str = iconv("GB2312","UTF-8","欢迎光临"); 
ImageTTFText($im, 20, 0, 30,40, $clr, $fnt, $str); ImagePNG($im); 
ImageDestroy($im); 

解决方案 »

  1.   

    xuzuning(唠叨) :$str = iconv("GB2312","UTF-8","欢迎光临");这句话是什么意思,好像在PHP中没有这个函数耶!请赐教!!!
      

  2.   

    iconv
    Convert string to requested character encoding (PHP 4 >= 4.0.5) 
    string iconv ( string in_charset, string out_charset, string str )It converts the string str encoded in in_charset to the string encoded in out_charset. It returns the converted string or FALSE, if it fails. 
      

  3.   

    PHP Version 4.3.2-RC1, 应该说是支持的,但还是没这个函数呀,怎么回事呢?
      

  4.   

    在php.ini中去掉下行前的';'
    ;extension=php_iconv.dll设置extension_dir = 正确的路径.
      

  5.   

    对了,各位仁兄,我在Windows2000 professional 中能运行,且能显示汉字,但在Solaris系统中却还是用不了,而且能看到iconv这个包在运行(用phpinfo())看的,不知应该如何加以处理???
      

  6.   

    还要安装TTF支持包,手册上有下载地址
      

  7.   

    还有,在Solaris系统中,是支持简体中文的,不知道这算不算行呢?
      

  8.   

    使用本功能需要在编译 PHP 前先安装 GD library,可到 http://www.boutell.com/gd 下载。在 1.6.2 版以前的 GD library 有支援 GIF 格式的功能,但因为 GIF 格式使用的 LZW 演算法牵涉到 Unisys 的专利权,因此在 GD library 1.6.2 版之后不支援 GIF 的格式。在安装 1.6.2 版时系统必须要有 libpng 及 zlib 二个动态连结函式库。前者可在 http://www.cdrom.com/pub/png 下载;后者可在 http://www.cdrom.com/pub/infozip/zlib 下载。而 GD library 也支援 TrueType 字型,请先到 http://www.freetype.org 下载动态连结程式库。
      

  9.   

    我的GD库都有安装,图表也能显示,就是不能出汉字呀,不知道是不是要$fnt = "simfang.ttf";是不是要指明具体路径呢?