Home > PHP Framework > YII > body text

How to reference external files in Yii

Release: 2019-12-17 15:32:17
Original
2498 people have browsed it

How to reference external files in Yii

Methods to reference files in Yii:

1, Yii::import("application.lib.PHPExcel.*");

Explanation:

application is equivalent to the protected folder.

2. In Yii’s ../config/main.php, introduce the base path

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.*',  
    ),  
)
Copy after login

You can use the following method to reference in the code

Yii::app()->basePath
Copy after login

PHP Chinese website, There are a large number of free Yii introductory tutorials, everyone is welcome to learn!

The above is the detailed content of How to reference external files in Yii. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
yii
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!