码迷,mamicode.com
首页 > 其他好文 > 详细

spl_autoload_register使用记录

时间:2015-06-08 16:54:40      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:

今天单点登陆要用到 spl_autoload_register,但是YII的Yii::autoload在包含失败的时候会抛异常,就不会执行(spl_autoload_call)其他spl_autoload_register的了, 于是想到了一个破解的办法,就是删除所有的spl_autoload_functions  然后把 单点登录的 autoload函数加上,最后再加上 Yii原有的autoload函数 即可。

// set up __autoload
if (function_exists(‘spl_autoload_register‘)) {
    if (!(spl_autoload_functions()) || !in_array(‘CAS_autoload‘, spl_autoload_functions())) {
        $functions = spl_autoload_functions();
        foreach($functions as $function) {
            spl_autoload_unregister($function);
        }
        spl_autoload_register(‘CAS_autoload‘);
        foreach($functions as $function) {
            spl_autoload_register($function);
        }
    }
}

 

spl_autoload_register使用记录

标签:

原文地址:http://www.cnblogs.com/sailrancho/p/4561042.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!