php: require_once

Suspended
Joined
30 Jan 2005
Posts
467
Is there a way to change

<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/myfile.php');
?>

So if 'myfile.php' cannot be found it loads a error message instead of showing the fatal errors?
 
How would I add a routine to this? Is it hard? Also, do you guys reccomend is_readable or file_exists?

<?php
$filename = 'test.txt';
if (is_readable($filename)) {
echo 'The file is readable';
} else {
echo 'The file is not readable';
}
?>
 
Back
Top Bottom