How to open and close a file in PHP?
In order to open a file we can use the function-fopen() which take name of the file as well as mode ,as its two parameter.
There are various modes.The table of some modeshas been given below:
For read only
For write only which creates the new file if does not exit or open and clear the content of the file.
It is for both read and write which creates the new file if does not exit or open and clear the content of the file.
It opens and write to the end of the file
//Code to open and close file using PHP
$file = fopen("text.txt","r");
It illustrate How to open text file (.txt extension) using PHP