Home  >  Article  >  Backend Development  >  How to solve php imagettftext garbled problem

How to solve php imagettftext garbled problem

藏色散人
藏色散人Original
2020-10-14 16:54:512525browse

php The solution to the garbled imagettftext: first transcode through the "mb_convert_encoding" function; then output through the statement "mb_convert_encoding($str, "UTF-8", "GB2312");".

How to solve php imagettftext garbled problem

Recommendation: "PHP Video Tutorial"

php uses ImageTTFText. Garbled characters appear in Chinese:

You can use

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

to transcode, and then output

such as

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

to confirm whether the file is utf-8.

The above is the detailed content of How to solve php imagettftext garbled problem. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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