Skip to main content
Version: Fegg 5.x (next)

File::readFile

Read a file and return its contents

Description​

public string File::readFile( string $fileName )

Returns the contents of $fileName, or an empty string when the file does not exist.

Arguments​

NameData typeDefaultRemarks
$fileNamestringFile to read

Example​

Controller
use Fegg\Tool\File;

$file = new File();
$contents = $file->readFile('path/to/foo.txt');