Php issues related to processing Chinese files and folders

Source: Internet
Author: User
Php processing of Chinese files and folders in php file UTF-8 format, file_exists need Chinese encoding format for gbk? Therefore, you can use $ path = iconv ('utf-8', 'gbk', '/data/wwwroot/dvis/cp/video/test directory php to process Chinese files and folders.

In PHP file UTF-8 format,

In file_exists, the Chinese encoding format is gbk?

Therefore

$ Path = iconv ('utf-8', 'gbk', '/data/wwwroot/dvis/cp/video/test directory/level 2 directory/ .mp4 ');

This format is converted to gbk encoding.

This path can be determined by file_exists.

But I found a problem. when I want to move the file to another folder

Rename ($ path, $ dst); returns false and cannot be moved and renamed

If the target is English and only the file name is Chinese, the rename can be executed.

If it is like the above path, it will not work.

Replace copy ($ path, $ dst); and then run unlink ($ path). The original file cannot be deleted.

?

It can be understood that the rename unlink operation cannot target Chinese folders or Chinese files. ,

The specific cause has not been found. first write a blog record

?

I wiped it for a long time, and it turned out to be due to permission issues. LINUX. Filezilla is an ftp tool that has poor support for Chinese characters. as a result, folder permissions cannot be changed, so you have never paid attention to permissions.

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.