Creating a file using php
How to create a file in php?
Creating a new file in php is done using the function fopen()
To create a file using php
a) call the function fopen with two required arguments.
b) the first argument should be the file name. The new file will be created with the file name under the current(same) directory.
c) the second argument should be 'w' indicating it as write mode.Creating a new file under different Directory:
To create a file in a different directory we have to pass the full file path as the argument for file name.
This will create a file named filename.txt under the directory "images/"
It is important to note that the directory specified in the path should exist.