← All built-ins / file_get_contents()

file_get_contents()

file_get_contents(string $s): string

Parameters

NameTypeDescription
$pathstringfile path

Return value

The whole file as a string; throws when the file cannot be opened.

Example

file_put_contents("/tmp/hphp_doc_demo.txt", "holy contents");
echo file_get_contents("/tmp/hphp_doc_demo.txt");
holy contents

See also

file_put_contents()fopen()fread()