zoukankan      html  css  js  c++  java
  • 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;
        }

  • 相关阅读:
    Alpha 冲刺 (7/10)
    Alpha 冲刺 (6/10)
    Alpha 冲刺 (5/10)
    Alpha 冲刺 (4/10)
    福大软工 · BETA 版冲刺前准备(团队)
    福大软工 · 第十一次作业
    Alpha 冲刺 (10/10)
    Alpha 冲刺 (9/10)
    Alpha 冲刺 (8/10)
    Alpha 冲刺 (7/10)
  • 原文地址:https://www.cnblogs.com/ldms/p/3388358.html
Copyright © 2011-2022 走看看