1. File and Directory Manipulation
These functions are used to create, delete, move, or rename files and directories.
fopen()— Opens a file or URL.fclose()— Closes an open file.rename()— Renames or moves a file or directory.unlink()— Deletes a file.rmdir()— Removes an empty directory.mkdir()— Creates a new directory.opendir()— Opens a directory.readdir()— Reads an entry from an open directory.closedir()— Closes an open directory.mkdir()— Creates a new directory.file_put_contents()— Writes data to a file (replaces the file if it already exists).file_get_contents()— Reads a file into a string.
2. File and Directory Permissions
These functions are used for managing file and directory permissions (read/write/execute).
chmod()— Changes the permissions of a file or directory.chown()— Changes the owner of a file or directory.chgrp()— Changes the group of a file or directory.fileperms()— Returns the permissions of a file.umask()— Sets the default file creation mask.
3. File and Directory Properties
These functions are used to retrieve information about files and directories.
file_exists()— Checks if a file or directory exists.is_file()— Checks if a given path is a regular file.is_dir()— Checks if a given path is a directory.is_readable()— Checks if a file or directory is readable.is_writable()— Checks if a file or directory is writable.is_executable()— Checks if a file or directory is executable.filemtime()— Returns the last modified time of a file.fileatime()— Returns the last access time of a file.filectime()— Returns the inode change time of a file.filesize()— Returns the size of a file.filetype()— Returns the type of a file (e.g., regular file, directory).stat()— Returns an array with file status information.fstat()— Returns the status of an open file.dirname()— Returns the directory name of a file path.basename()— Returns the filename from a file path.pathinfo()— Returns information about a file path.
4. File Reading and Writing
These functions are used to read from and write to files.
fread()— Reads a file.fwrite()— Writes to a file.fgets()— Reads a line from a file.fgetcsv()— Reads a CSV line from a file.file()— Reads a file into an array.file_get_contents()— Reads the entire content of a file into a string.file_put_contents()— Writes data to a file.readfile()— Reads a file and sends it directly to the output.fprintf()— Writes formatted data to a file.
5. File Uploads
These functions are used for handling file uploads.
move_uploaded_file()— Moves an uploaded file to a new location.is_uploaded_file()— Checks if a file was uploaded via HTTP POST.$_FILES— An array containing file upload information (used in conjunction with form file uploads).
6. Directory Traversal
These functions are used to traverse directories, list files, and iterate over directory contents.
opendir()— Opens a directory for reading.readdir()— Reads the next entry in an open directory.rewinddir()— Resets the directory pointer to the beginning of a directory.closedir()— Closes an open directory.scandir()— Returns a list of files and directories in a directory.glob()— Finds pathnames matching a pattern (e.g.,*.txt).dir()— Creates aDirectoryobject for traversing directories (object-oriented approach).
7. File Locking
These functions are used for locking files to prevent other processes from modifying them.
flock()— Acquires or releases a file lock.lockf()— Locks or unlocks a file (using file descriptor).fnctl()— Performs control operations on a file descriptor (Unix-based).
8. Temporary Files and Directories
These functions are used to create temporary files and directories.
tempnam()— Creates a temporary file with a unique name.tmpfile()— Creates a temporary file and returns a file handle.sys_get_temp_dir()— Returns the system's temporary directory path.
9. File and Directory Traversal (Recursion)
These functions are used for recursively traversing directories and working with nested structures.
RecursiveDirectoryIterator— Iterates over directories and subdirectories.RecursiveIteratorIterator— Provides a recursive iterator for iterating through nested directories.DirectoryIterator— Iterates over files and directories in a directory.
10. Compression and Archiving
These functions help with creating or extracting compressed files and archives.
gzopen()— Opens a gzipped file for reading or writing.gzread()— Reads from a gzipped file.gzwrite()— Writes to a gzipped file.gzclose()— Closes a gzipped file.zip_open()— Opens a ZIP archive.zip_read()— Reads a file from a ZIP archive.zip_close()— Closes a ZIP archive.tar()— Creates a TAR archive.
11. Miscellaneous Functions
Other miscellaneous filesystem-related functions:
disk_free_space()— Returns the free space available on a disk or directory.disk_total_space()— Returns the total space on a disk or directory.realpath()— Returns the absolute path of a file or directory.clearstatcache()— Clears the file status cache, used after modifying file information.file_exists()— Checks if a file or directory exists.touch()— Sets the access time and modification time of a file.
No hay comentarios:
Publicar un comentario