Summarize what PHP file functions are

Source: Internet
Author: User
Simple to organize some PHP operation files commonly used functions:

  • FileType () Gets the file type function Is_dir () determines whether a given file name is a directory is_executable () determines whether a given document is executable Is_file () determines if a given file exists Is_link () determines whether a given file is a symbolic link ( Soft link) is_readable () determines whether a given file is readable is_writeable () determines whether a given file is writable file_exists () determines whether a file or directory exists filesize () gets the file size (cannot get the directory size) filectime () file creation time Filemtime () file modified time Fileatime () file access time stat () get file most parameters basename ($path, [$suffix]) Get filename $path URL address $suffix optional, provision  Extension 1 <?php2 3 $url = ' http://www.this.com/test/abc.php '; 4 echo basename ($url) If there is an extension of this name; ABC.PHP5 Echo basename ($url, '. php '); ABC DirName ($PATH) Get path address $path URL address 1 <?php2 echo dirname ("http://www.cs.com/a/b/ab.php"); Http://www.cs.com/a/b PathInfo ($path, [options]) Get path information $path incoming path $option rules return array elements, return all elements by default 1 <?php 2 $ Path = ' http://localhost/a/b/ab.php '; 3 Print_r (PathInfo ($path));     4//Array (5//' dirname ' = ' http://localhost/a/b ', 6//' basename ' = ' ab.php ', 7// ' Extension ' = ' php ', 8//' filename ' = ' a 'B ' 9///) Print_r (PathInfo ($path, pathinfo_dirname)); Http://localhost/a/b11 Print_r (PathInfo ($path, pathinfo_basename)); AB.PHP12 Print_r (PathInfo ($path, pathinfo_extension)); Php13 Print_r (PathInfo ($path, pathinfo_filename)); AB Opendir () opens a directory that returns a directory resource handle Readdir (' resource handle ') to get a file or directory from the directory, and the pointer moves down a closedir (' resource handle ') to close the Open Directory Rewinddir (' resource handle ') will refer to  The needle moves to the first disk_free_space (' C: ') returns the specified directory free space Disk_total_space (' C: ') returns the specified directory total size mkdir () Create a directory rmdir () delete a directory unlink () delete a file return bool value copy () Copying files does not support copying directories

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.