agangdi

agangdi

这家伙有点懒,还没写个性签名!

  • 财富值25
  • 威望值0
  • 总积分25

个人信息

  • 发布了话题
    Yii 引入扩展时类名必须和文件名一样?
  • 求教,我使用 webapp 生成的目录中,没有protected/vendors这个目录,但是按照 http://www.yiiframework.com/doc/guide/1.1/zh_cn/extension.integration#add-comment
    上所述的使用第三方库的方法,需要到这个文件夹,所以我自己建立了该文件夹,然后使用将PHPExcel 目录拷贝到 protected/vendors/phpexcel/Classes/PHPEXcel 位置。现在的目录结构如下:

    ▾ vendors/                  
      ▾ phpexcel/              
        ▾ Classes/             
          ▸ PHPExcel/            
            PHPExcel.php
    

    最后我在controller文件里面使用:

    Yii::import('application.vendors.*');
    require_once "phpexcel/Classes/PHPExcel.php";
    

    来引入库,执行时报错:

    include(PHPExcel_Shared_String.php): failed to open stream: No such file or directory
    
    /home/john/workspace/cuc-mis/trunk/yii-1.1.13/framework/YiiBase.php(421)
    
    409                         {
    410                             include($classFile);
    411                             if(YII_DEBUG && basename(realpath($classFile))!==$className.'.php')
    412                                 throw new CException(Yii::t('yii','Class name "{class}" does not match class file "{file}".', array(
    413                                     '{class}'=>$className,
    414                                     '{file}'=>$classFile,
    415                                 )));
    416                             break;
    417                         }
    418                     }
    419                 }
    420                 else
    421                     include($className.'.php');
    422             }
    423             else  // class name with namespace in PHP 5.3
    424             {
    425                 $namespace=str_replace('\\','.',ltrim($className,'\\'));
    426                 if(($path=self::getPathOfAlias($namespace))!==false)
    427                     include($path.'.php');
    428                 else
    429                     return false;
    430             }
    431             return class_exists($className,false) || interface_exists($className,false);
    432         }
    433         return true;
    
试用期 等级规则
25/50
资料完整度
20/100
用户活跃度
0/100

Ta的关注

0

Ta的粉丝

0

Ta的访客

1