PHP File Handling
File handling is an important part of all type of PHP web application.
PHP has in-built file system function to access and manipulate the file.
In this PHP tutorial we learn manipulate various type of file using file system functions.
PHP has functions for creating file, reading files, opening files, uploading files and editing files.
The files can be .doc file, .txt file, .xml file any kind of file supports all php function for manipulate files.
PHP File manipulation functions :
- touch() – used to create a file.
- unlink() – used to delete a file.
- copy() – used to copy a file.
- rename() – used to rename a file.
- file_exists() – used to check whether the file exists or not.
- filesize() – used to check size of file.
- realpath() – used to check real path of file.
- fopen() – used to open existing file.
- fread() – used to reads from an pen file.
- fwrite() – used to write to file.
- fclose() – used to close an open file.
- fgets() – used to read a single line from a file.
- fgetc() – used to read a single character from a file.
- feof() – used to check ‘end of file’.
- Learn fgets(), fgetc() and feof() function
We will learn all above file system function one by one in next php tutorial.