2020.02新版

This commit is contained in:
Blokura
2020-02-21 16:20:55 +08:00
parent 45e2415d71
commit a2f29a310b
755 changed files with 95144 additions and 0 deletions

37
includes/autoloader.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
/**
*
* 自动载入函数
*/
class Autoloader
{
/**
* 向PHP注册在自动载入函数
*/
public static function register()
{
spl_autoload_register(array(new self, 'autoload'));
}
/**
* 根据类名载入所在文件
*/
public static function autoload($className)
{
// DIRECTORY_SEPARATOR目录分隔符linux上就是/ windows上是\
$filePath = __DIR__ . DIRECTORY_SEPARATOR . $className;
$filePath = str_replace('\\', DIRECTORY_SEPARATOR, $filePath) . '.php';
if (file_exists($filePath)) {
require_once $filePath;
return;
// if(method_exists($className, "init")) {
// call_user_func(array($className, "init"), $params);
// }
} else {
echo "无法加载" . $filePath;
}
}
}