C&P fra php.net:
mode may be any of the following:
\'r\' - Open for reading only; place the file pointer at the beginning of the file.
\'r+\' - Open for reading and writing; place the file pointer at the beginning of the file.
\'w\' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
\'w+\' - Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
\'a\' - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
\'a+\' - Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
Note: The mode may contain the letter \'b\'. This is useful only on systems which differentiate between binary and text files (i.e. Windows. It\'s useless on Unix). If not needed, this will be ignored.
You can use the optional third parameter and set it to \"1\", if you want to search for the file in the include_path, too.
Example 1. Fopen() example
$fp = fopen (\"/home/rasmus/file.txt\", \"r\");
$fp = fopen (\"/home/rasmus/file.gif\", \"wb\");
$fp = fopen (\"
http://www.php.net/\", \"r\");
$fp = fopen (\"
ftp://user:password@example.com/\", \"w\");