Read a file into a string with file_get_contents in PHP

Description

The following code shows how to read a file into a string with file_get_contents.

Example



<?php
    echo file_get_contents("test.txt");
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    File »




Directory
DirectoryIterator
Drive
File
File Permission
File Read Save
FileSystemIterator
Path
Zip