Section: jFile: file processing
« jMessage: short messages between actions | ^ Class utilities |
− Table of content
jFile help to do file processing. All methods of jFile are statics, so you don't have to instanciate this class.
read method ¶
It returns the content of a file, or false
if the file doesn't exist.
$content = jFile::read('/path/to/file.ext');
write method ¶
Write data into a file. It uses a temporary file, and then rename it to the given name, in order to limit access conflicts.
It returns true
if it is a success.
jFile::write('/path/to/file.ext', 'my data');
createDir method ¶
Create a directory. If parents don't exist, they are also created.
jFile::createDir('/path/of/the/directory/');
removeDir method ¶
Delete recursively the content of a directory. The second parameter allow to delete (true
by default) or no (false
) the directory itself.
jFile::removeDir('/path/of/the/directory', false);
// only the content of the directory will be deleted
jFile::removeDir('/path/of/the/directory');
// The content of "directory" AND the directory itself will be deleted