php - 关于imagettftext乱码的问题

查看:101
本文介绍了php - 关于imagettftext乱码的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

imagettftext函数在windows下中文显示正常,在linux下中文就出现了乱码。。。
核心代码如下:

//此处省略N行。。。
$image = imagecreatetruecolor($width, $height);
$color = imagecolorallocate($image, $red, $green, $blue);
imagefill($image, 0, 0, $color);
$tcolor = imagecolorallocate($image, $tred, $tgreen, $tblue);
//imagestring ($image,  $fontfile,  20 ,  20 ,  "Hello world!" ,  $tcolor);
//echo floor(($height - $fontinfo['height']) / 2);die;
imagettftext($image, $tsize, 0, ($width - $fontinfo['width']) / 2, $height / 2, $tcolor, $fontfile, $text);
//此处省略N行。。。

转码什么的都试过了,不行!也觉得不是编码的问题。。。
linux下也已经安装了msyh.ttf字体。。。

windows下显示:

linux下显示:

还望各位兄弟姐妹看看,小弟先谢过了!

解决方案

%e6%88%91urlencode('我')的结果,是不是通过URL进行参数传递没有解码的问题。
我很奇怪windows上是白色的,怎么Linux下就黄了。。

这篇关于php - 关于imagettftext乱码的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆