Chinese garbled code in PHP's imagettftext method

巴扎黑
Release: 2016-11-08 13:21:12
Original
2564 people have browsed it

Analysis:
1. Confirm whether the gb library is installed correctly? If there is no report, this method does not exist.
2. imagettftext() must be encoded in utf-8. The entire PHP project is encoded in utf-8, so you don’t need to think too much. If not, you can convert it with mb_convert_encoding();
3. Check whether the font is loaded correctly, write down the font path, and change multiple fonts (commonly used Chinese font files are simsun.ttc and simhei.ttf), if it still doesn’t work, confirm It shouldn't be a font issue.

Then I saw someone online saying: Please check whether you added the –enable-gd-jis-conv option when compiling the gd library. This option is to allow the gd library to support Japanese-encoded fonts. Please cancel this option and recompile. .

Then I checked my php compilation options and found that this parameter was added. Do I need to recompile?
Just when my balls hurt, I saw another article:

$str=mb_convert_encoding('Chinese characters', "html-entities", "utf-8"); //Convert to html encoding

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!