imagettftext —写入中文导致乱码

超人不会飞呐 2016-01-29 05:52:16
imagettftext —写入中文导致乱码,GD库啥都文件配置好了,英文可以,换成中文就乱码.....求解决
<?php
session_start();
$image=imagecreate(320, 210);
$bg=imagecolorallocate($image, rand(252,255),rand(252,255),rand(252,255));
$font='ttfs/simhei.ttf';
$word='猪';
$word=iconv('GB2312', 'UTF-8', $word);
for($i=0;$i<20;$i++){
$color=imagecolorallocate($image,rand(0,233),rand(0,211),rand(0,100));
imagettftext($image,rand(1,20),rand(0,45),rand(0,150),rand(0,100),$color,$font,$word);
}
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
...全文
217 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
超人不会飞呐 2016-01-29
  • 打赏
  • 举报
回复
已解决了,这是可以的,可能刚才出现缓存问题。
xuzuning 2016-01-29
  • 打赏
  • 举报
回复
请贴出乱码截图

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧