FILE Methods
Reading and writing
directory(), collect(), read(), write()File operations
remote(), output(), download(), version()
write()
Write data to local file.
string write( string file, string content [, int mode = 0 ])
Return
Returns the file's name and path if writing was successful.
Parameter
Description
fileName of the file to be written to.
contentData to be written to file.
mode0 = write only if file doesn't exist
1 = append file
2 = delete existing file
1 = append file
2 = delete existing file
Delete existing file before writing
$FILE->write("data/test.txt", "test", 2)
RETURN: '/var/.../.../data/test.txt'
Append File
$FILE->write("data/test.txt", "test", 1)
RETURN: '/var/.../.../data/test.txt'
Only Write If File Doesn't Exist
$FILE->write("data/test.txt", "test", 0)
RETURN: FALSE