<?php
class A
{
public static function loadClassFunc($className)
{
$file = $className.'.class.php';
if(is_file($file))
{
require_once($file);
}
}
}
spl_autoload_register( array('A','loadClassFunc'));
//等价于:sql_autoload_register(A::loadClassFunc);
$obj = new PRINT(); // PRINT类存在于 PRINT.class.php文件中
$obj->func1();
?>
PHP的spl_autoload_register用法
最新推荐文章于 2024-10-08 13:11:11 发布