代码:
$im=imagecreatetruecolor(200,200);
$red=imagecolorallocate($im,255,0,0);
$green=imagecolorallocate($im,0,255,0);
$blue=imagecolorallocate($im,0,0,255);imagefill($im,0,0,$blue);$name=iconv("gd2312","utf-8","盼盼");
imagettftext($im, 25, 0, 60, 90, $red, "STCAIYUN.ttf",$name);header("content-Type:image/jpeg");
imagejpeg($im);

我想输出,盼盼两个中文字符

解决方案 »

  1.   

    This line is causing the problem:imagettftext($im, 25, 0, 60, 90, $red, "STCAIYUN.ttf",$name);Make sure STCAIYUN.ttf is present in same location as your script file. Or you can set php environment variable GDFONTPATH to location of fonts.Hope it helps.//Ali
      

  2.   

    thank you all the same。Issue is not resolved
    我的目录下有那个字体文件,不是这个问题
      

  3.   

    error_reporting(E_ALL);
    看看报什么错误。
      

  4.   

    没有报错,我错误提示设置了,在ie9里是一个叉叉,在chrome中,啥都没有
    去掉incov后,出现图像,没有字符。。
      

  5.   

    what is in error_log ?//Ali
      

  6.   

    从这个现象判断,很可能是你的 PHP 配置里没有启用 iconv() 功能。
    ————————————————————————————————
    基于CSDN论坛提供的插件扩展功能,自己做了个签名档工具,分享给大家,欢迎技术交流 :)
      

  7.   


    missing extension would have popped-up a error something like undefine function call ....//Ali
      

  8.   

    gd库用unicode编码,也就是等同与html实体编码(&#xxxx;)
    <?php
    $im=imagecreatetruecolor(200,200);
    $red=imagecolorallocate($im,255,0,0);
    $green=imagecolorallocate($im,0,255,0);
    $blue=imagecolorallocate($im,0,0,255);imagefill($im,0,0,$blue);//$name=iconv("gd2312","utf-8","盼盼");
    $name = mb_convert_encoding("盼盼", 'HTML-ENTITIES', 'GBK');// 我没有你的字体
    imagettftext($im, 25, 0, 60, 90, $red, "SIMYOU.ttf",$name);header("content-Type:image/jpeg");
    imagejpeg($im);
      

  9.   


    error_reporting(E_ALL);$im=imagecreatetruecolor(200,200);
    $red=imagecolorallocate($im,255,0,0);
    $green=imagecolorallocate($im,0,255,0);
    $blue=imagecolorallocate($im,0,0,255);imagefill($im,0,0,$blue);$name=iconv("gd2312","utf-8","盼盼");
    imagettftext($im, 25, 0, 60, 90, $red, "STCAIYUN.ttf",$name);//header("content-Type:image/jpeg");
    //imagejpeg($im);
    这样看有没有错误,把错误代码贴出来
      

  10.   

    晕,只是手误,把gb2312写成gd2132,呵呵