Home>Article>Backend Development> What to do if the php directory file name is Chinese garbled

What to do if the php directory file name is Chinese garbled

藏色散人
藏色散人 Original
2021-10-29 10:23:23 2357browse

Solution to Chinese garbled names of php directory files: 1. Read the Chinese word files in the specified folder and generate a list of file names; 2. Use "iconv('GB2312', 'UTF-8' $v )" method to convert the encoding.

What to do if the php directory file name is Chinese garbled

The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer

What to do if the php directory file name is Chinese garbled ?

php solution for reading garbled Chinese file names in the directory:

Recent project needs to read Chinese word files in the specified folder and generate a list of file names .

Direct reading will cause garbled characters, and there is a problem with the file name and table name.

Solution:

Loop the read file name and convert the encoding

iconv('GB2312', 'UTF-8' $v)

Recommended study: "PHP Video Tutorial"

The above is the detailed content of What to do if the php directory file name is Chinese 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