如何解决php imagettftext 乱码问题

藏色散人
藏色散人原创
2023-03-06 17:02:011741浏览

php imagettftext乱码的解决办法:首先通过“mb_convert_encoding”函数进行转码;然后通过语句“mb_convert_encoding($str, "UTF-8", "GB2312");”输出即可。

推荐:《PHP视频教程

php 使用ImageTTFText 中文出现乱码:

可以用

string mb_convert_encoding ( string $str, string $to_encoding [, mixed $from_encoding] )

来进行转码,再输出

$str = mb_convert_encoding($str, "UTF-8", "GB2312");

确认一下文件是不是utf-8的。

以上就是如何解决php imagettftext 乱码问题的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。