Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yii class is not loading

Tags:

php

yii

While trying to include my own class library in Yii. I used this code to include a class file in Yii.

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

myfile lies at [protected/apis/myapi.php]

I don't know 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]
like image 318
Shahid Karimi Avatar asked Oct 10 '22 09:10

Shahid Karimi


1 Answers

I think you should import as

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

It will import all php files under directory applications/apis/.

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

EDIT: also check this question: Yii import functionality

like image 104
briiC Avatar answered Oct 27 '22 02:10

briiC