Mega Code Archive

 
Categories / Php / File Directory
 

Fopen() function opens a file, returns an integer, as a file handle

Its syntax is: int fopen (string file, string mode [, int use_include_path]) The mode specifies the read/write readiness of the file.  MODE         MEANING r            Read only.  r+           Reading and writing. w            Write only. w+           Reading and writing. a            Write only. a+           Reading and writing. If use_include_path is set to 1, file path is compared to the include path contained in the php.ini file.  <?     $file = "data.txt";                                             // some file     $fh = fopen($file, "a+") or die("File ($file) does not exist!"); ?>