Yii class not loading

When trying to include my own class library in Yii. I used this code to include the class file in Yii.

Yii::import('application.apis.myapi.*');

myfile is in [protected/apis/myapi.php]

I do not know that I am getting this error:

[YiiBase::include(myapi.php) [<a href='function.YiiBase-include'>function.YiiBase-include</a>]: failed to open stream: No such file or directory]
+5
source share
2 answers

I think you should import as

Yii::import('application.apis.*');

It will import all php files into the application / apis / directory .

Yii::import('application.apis.myapi'); //only one file

EDIT : also check this question: Yii import functions

+4
source

Perhaps you override basePathfor your application? (look protected/config/main.cfg)

0
source

All Articles