PHP File Handling
In PHP, file handling is done using a set of built-in functions that allow you to create, open, read, write, and close files. Here's a quick overview of the key functions and examples for common file operations:
1. Opening a File
-
"r"
: Read only -
"w"
: Write only (erases contents) -
"a"
: Append -
"x"
: Create and write only if file doesn't exist