Mailinglisten-Archive |
Hallo Alex,
> Gibt es da einen eleganteren Weg als die Fehlermeldung beim includieren
> mittels @ zu unterdrücken?
>
> $check = @inlcude 'MDB2.php';
> if (!$check) {
> ...
> }
>
ich benutze dann folgendes ->
<?php
function is_includable($filename, $returnpaths = false) {
$include_paths = explode(PATH_SEPARATOR, ini_get('include_path'));
$includable_paths = array();
foreach ($include_paths as $path) {
$include = $path.DIRECTORY_SEPARATOR.$filename;
if (is_file($include) && is_readable($include)) {
if ($returnpaths == true) {
$includable_paths[] = $path;
} else {
return true;
}
}
}
return (isset($includable_paths) && $returnpaths == true) ?
$includable_paths : false;
}
$ret = is_includable('Auth.php', true);
var_dump($ret);
?>
ist nicht von mir sondern http://de3.php.net/include/
medhefgo at googlemail dot com
27-May-2006 01:50
Gruß
Niels
php::bar PHP Wiki - Listenarchive