PHP – file_get_contents failed to open stream?


This topic contains 0 replies, has 1 voice, and was last updated by  Sravan Kumar 6 years, 6 months ago.

Viewing 1 post (of 1 total)
  • Author
  • #3645

    Sravan Kumar

    Whenever you are trying to get the contents of external or internal file, file_get_contents() is the function we use. We can even check whether the external file exists or not with this method, following is the simple code which checks whether the external or internal file exists and can add your own custom error message when returns an error:

    $file_result = file_get_contents($
    if ($file_result === false){
    echo "File doesn't exists - Custom errors";
    echo "File access is successful, you can continue with coding";

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Send this to a friend