api 1.1构架篇

首先让其自动加载???

   在YiiBase.php里面 改写autoload方法:

      /**
     * Class autoload loader.
     * This method is provided to be invoked within an __autoload() magic method.
     * @param string $className class name
     * @return boolean whether the class has been loaded successfully
     */
    public static function autoload($className)
    {
        // use include so that the error PHP file may appear
        if(isset(self::$_coreClasses[$className])){
            include(YII_PATH.self::$_coreClasses[$className]);
        }else if(isset(self::$classMap[$className])){
            include(self::$classMap[$className]);
        }else{
            if(strpos($className,'\\')===false)
                @include($className.'.php');
            else  // class name with namespace in PHP 5.3
            {
                $namespace=str_replace('\\','.',ltrim($className,'\\'));
                if(($path=self::getPathOfAlias($namespace))!==false)
                    include($path.'.php');
                else
                    return false;
            }
            return class_exists($className,false) || interface_exists($className,false);
        }
        return true;
    }

posted on 2013-10-25 17:48 jason&li 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/ldms/p/3388358.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值