fopen
( PHP 3, PHP 4, PHP 5) fopen - Opens file or URL
Description
The function fopen () opens a collegamneto between a resource, specified by filename, and a flow. If filename is a "scheme ://...", takes a URL and PHP will look for the module management protocol (also known as wrapper) for that scheme. If you are not registered for the wrapper required protocol, PHP will generate a message to help find potential problems in the script, and then proceeds whereas filename as a regular file.
The mode parameter indicates the type of access required for the flow. It can be:
'r': Open for reading only, place the pointer at the beginning of the file.
'r +': Open for reading and writing, place your cursor at the beginning of the file.
'w': Opens the file for writing only, place your cursor at the beginning of the file and truncate the file to zero length. If the file does not exist, try to create it.
'w +': Open for reading and writing, place the pointer beginning of the file and truncate the file to zero length. If the file does not exist, try to create it.
'a': Open for writing only, place the pointer at the end of the file. If the file does not exist, try to create it.
'a +': Open for reading and writing, place the pointer at the end of the file. If the file does not exist, try to create it.
Example 1. Examples of fopen ()
If you experience problems with reading and writing files and you are using the server version of PHP, you must verify that the files and directories used by the script are accessible from the server process. On the Windows platform
attention should be paid to the backslash in file paths, which should be preceded by the escape character '\\', or use the slash '/'.
source: http://www.php.net/
0 comments:
Post a Comment