September 2001
Intermediate to advanced
768 pages
32h 45m
English
resource fopen(string filename, string mode)
Opens a file.
Returns:
File handle
Description:
fopen() opens a file on the current system and positions the file pointer at the beginning of the file. If PHP has been configured to be URL-aware, prefixing the filename with either http:// or ftp:// opens a connection to the specified URL and returns the contents of the specified file. HTTP requests are not redirected, so any requests to a directory must have a trailing slash appended and FTP connections must be made to servers with support for passive mode transfers. The mode strings can be one of the following:
| Mode String | Function |
|---|---|
| r | Read only |
| r+ | Read and write, preserves file contents (overwrites existing content on write operations) |
Read now
Unlock full access