Home>Article>Backend Development> What to do if the php directory file name is Chinese garbled
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.
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!