时间:2021-07-01 10:21:17 帮助过:49人阅读
class autoLoader
{
public static function myLoader($classname)
{
$class_file = strtolower($classname).".php";
if (file_exists($class_file)){
require_once($class_file);
}
}
}
// 通过数组的形式传递类和方法,元素一为类名称、元素二为方法名称
// 方法为静态方法
spl_autoload_register(array("autoLoader","myLoader"));
$test = new Test();
// 通过数组的形式传递类和方法,元素一为类名称、元素二为方法名称
// 方法为静态方法
spl_autoload_register(array("autoLoader","myLoader"));