Search code snippets, questions, articles...

Read file content using PHP

    $file_path = "/path/to/file";
    $file_content = file_get_contents($file_path);
    echo $file_content;
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.
Print content exist on file

In PHP, you can read content from a file using file_get_contents() function. You will have to pass file path inside it as a parameter and it return the file content if it exist on on the file. You can also check if file exist on the location or not using file_exists function in PHP.

Search Index Data (The code snippet can also be found with below search text)

Get data from file using PHP
Was this helpful?