Common ways to manipulate files in PHP

Source: Internet
Author: User

Create a folder:

mkdir system functions, the first parameter is the path, the second parameter is the permission, the third parameter is whether to create recursively, the default permissions are 0777 maximum permissions, there is no so-called permissions under Windows, under Linux can set permissions, if the directory exists will return false, error.

Recursive creation:

Parameter value: Ture/false

#例如想要在这个路径下创建一个文件夹 $path='./dir/a/b/c'; #如果中间有目录缺失, is not automatically created, default is no recursive creation # If created recursively, these directories can be generated automatically by the

Is_dir: You can determine whether a directory exists before you create it.

DirName: can get relative parent path for example the current script path is: [./dir/a/b/c/d] can get to [./dir/a/b/c]

Realpath: Can get the absolute path from the drive letter to the script

Open folder:

Opendir: Open Directory, return resource type

Readdir: Open the folder's resource, the return value is the name of the folder

Closedir: Close the directory, try to close it manually, save system resources

Common ways to manipulate files in PHP

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.