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