How to solve php imagettftext garbled problem

藏色散人
Release: 2023-03-06 17:02:01
Original
2377 people have browsed it

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] )
Copy after login

to transcode, and then output

such as

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

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!

Related labels:
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
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!