This is an old revision of the document!
WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0
Open a file for reading or writing
Attempt to open a file or stream for reading or writing, and return the file handle for future operations
filename: If a path is omitted, the current directory will be used to search for the file. Relative paths are supported. Two special file names will open specific streams instead:
mode: The following strings are supported:
Upon success it returns a file handle which may be used together with the other file functions that require a handle such as fgets(), fwrite(), fclose() and feof()
If the attempt to open the file or stream fails it will return 0
<? $f=fopen("/index.cgi","r"); if ($f) { print("File opened successfully"); fclose($f); } else { print("File open failed"); } ?>
f485open() - Open the RS-485 port as a stream
fseropen() - Open the serial port as a stream
fsockopen() - Open an internet socket connection
fclose() - Close a file, stream or socket
feof() - Test if no more data is available in a file or stream
fgets() - Return a single line from a file or stream, with optional size limit
fread() - Return bytes from a file or stream
fseek() - Position the file pointer in an open file
ftell() - Return current file position in an open file
fwrite() - Write data to a file or stream
tar_put() - Add a file to an open file in TAR format
chdir() - Change uPHP's current directory
if - Flow control structure for conditional execution