php class Test public static function test_load file if is_file _SERVE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?php
class Test
{
public static function test_load($file)
{
if (is_file( $_SERVER['DOCUMENT_ROOT']. '/' . $file . '.php')) {
return require($_SERVER['DOCUMENT_ROOT'].'/' . $file . '.php');
} else {
echo 'Нет такогофайла';
return false;
}
}
}
$trololo = new Test();
$trololo -> test_load('file');
?>