eldereth Posted May 9, 2010 Share Posted May 9, 2010 This is the code i currently have <?php $val = $_GET['skill'] . '.html'; ?> <?php $homepage = file_get_contents($val); echo $homepage ?> And all im wanting to do is if file_get_contents = false to say 'Sorry, the file was not found'. if true to do the echo as above thankyou very much Link to comment https://forums.phpfreaks.com/topic/201149-how-do-i-add-error-checking-to-file_get_contents/ Share on other sites More sharing options...
trq Posted May 9, 2010 Share Posted May 9, 2010 <?php $val = $_GET['skill'] . '.html'; if ($homepage = file_get_contents($val)) { echo $homepage; } else { echo 'Sorry, the file was not found'; } ?> Link to comment https://forums.phpfreaks.com/topic/201149-how-do-i-add-error-checking-to-file_get_contents/#findComment-1055312 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.