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 it is not a file or cannot be read. The whole file is read into memory: send a large file to the browser with File::output.
Arguments
| Name | Data type | Default | Remarks |
|---|---|---|---|
| $fileName | string | File to read |
Example
Controller
use Fegg\Tool\File;
$file = new File();
$contents = $file->readFile('path/to/foo.txt');