Php creates Chinese folders with garbled characters

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.