Home  >  Article  >  Backend Development  >  What to do if php fread is garbled?

What to do if php fread is garbled?

藏色散人
藏色散人Original
2020-09-30 09:09:402183browse

php fread garbled solution: first read the file directly through the fread function; then transcode the read content through the "iconv('gbk', 'utf-8', $data)" method That’s it.

What to do if php fread is garbled?

Recommendation: "PHP Video Tutorial"

In php, read the file directly through the fread function, and the file content If you encounter Chinese, garbled characters will appear. How to solve this problem?

Solution:

Try transcoding the content after reading it out

iconv('gbk', 'utf-8', $data)

The above is the detailed content of What to do if php fread is garbled?. 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