Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
<?php
// 类的自动加载
namespace load;
spl_autoload_register(function ($class) {
// 类名
$path = str_replace('\\', DIRECTORY_SEPARATOR, $class);
// 类文件名
$file = __DIR__ . '/' . $path . '.php';
if (is_file($file) && file_exists($file)) {
require $file;
} else {
die($file . '不存在');
}
});
use admin\controller\Index;
use admin\model\User;
use admin\view\index\Hello;
echo Index::show() . PHP_EOL;
echo User::show() . PHP_EOL;
echo Hello::show() . PHP_EOL;