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;
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?
Programming Feeds
Learn something new everyday on Devsheet