agangdi
求教,我使用 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;