Yii1加载第三方类库

2017-04-13  本文已影响49人  liamu
       echo get_include_path();echo "<br>";
       echo Yii::app()->basePath;echo "<br>";
       set_include_path('.'. PATH_SEPARATOR . Yii::app()->basePath.'/verdors/Pdf.php' . PATH_SEPARATOR . get_include_path());
       echo get_include_path();echo "<br>";
       $pdf = new Pdf();
       $pdf->test();echo "<br>";
        Yii::import("application.vendors.*"); 
        $pdf = new Pdf();
        $pdf->test();

解释:application相当于protected文件夹

return array(  
    'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',  
  ......  
    // autoloading model and component classes  
    'import'=>array(  
        'application.models.*',  
        'application.components.*',  
        'application.helpers.*', // helper methods  
        'ext.mail.Message',  
        'application.lib.*',  
    ),  
)
上一篇下一篇

猜你喜欢

热点阅读