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(); ?>
相关文章推荐
- 一个关于if else容易迷惑的问题
- Android Native 绘图方法
- PHP5.2.*防止Hash冲突拒绝服务攻击的Patch
- 深入理解PHP之匿名函数
- JSP/PHP基于Ajax的分页功能实现
- 关于PHP通过PDO用中文条件查询MySQL的问题。
- 什么是设计模式
- PHP数据库长连接mysql_pconnect的细节
- Php Installing An Expansion
- rem : web app适配的秘密武器
- jquery高级应用之Deferred对象
- 关于浮动与清除浮动,你应该知道的
- 数组reduce方法的高级技巧
- php7 读取php.ini[4]
- Mootools 1.2教程 函数
- autoit InputBox 函数
- 文件遍历排序函数
- 关于C#中排序函数的总结