Php creates a Chinese folder with garbled characters. recently, the younger brother is working on a php Project. He needs to use php to create a folder. the folder name may be Chinese, when mkdir is used to create a folder, the Chinese folder name becomes garbled. what is the problem? Is there any way to create a Chinese folder? thank you !, In Chinese windows, we usually use gbk encoding to create a file (folder )., Why do I have to use the Chinese name php to create Chinese folders with garbled characters?
The younger brother is working on a php project recently. He needs to use php to create a folder. the folder name may be Chinese. when mkdir is used to create a folder, the folder name in Chinese becomes garbled, what is going on? Is there any way to create a Chinese folder? thank you!
------ Solution --------------------
In Chinese windows, we usually use gbk encoding to create a file (folder ).
------ Solution --------------------
Why must I use a Chinese name? can you ensure that the code for creating a Chinese Directory runs on different servers?
------ Solution --------------------
It must be in Chinese.
Mkdir (iconv ("UTF-8", "GBK", "Chinese"), 0777); // page encoding UTF-8
However, we strongly recommend that you give up this practice ......
------ Solution --------------------
Windows: GBK
UTF-8: LINUX
Different systems use different codes
------ Solution --------------------
Reference:
I also thought about this, but when a user uploads the file for the first time, he does not know the id in the database table and cannot use the id as the folder name, so I gave up this method.
First upload to a folder
After registration, you will know the id.