Open a file in PHP:
To open a file in PHP fopen() funtion is used. Syntax:
fopen(filename, mode)
filename is the name of the file you want open. mode can be r,w,a,x,r+,w+,a+,x+.
Read a file in PHP:
To read an open file fread() function is used. This function have two parameters:
- first parameter contains the name of the file to read.
- second parameter specify the number of bytes to read.
Syntax:
fread($myfile,number_of_bytes);
Close a file in PHP:
To close an open file in PHP fclose() function is used. It only requires a name of the file to close.
Syntax:
fclose($myfile);
0 Comment(s)