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.

Was this helpful?