您的位置:首页 > 编程语言 > PHP开发

PHP的spl_autoload_register用法

2016-07-23 15:30 609 查看
<?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 函数 class