Home > Article > Backend Development > How to solve php imagettftext garbled problem
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");".
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!