我在我的Yii应用程序中创建了2个控制器:FirstController.PHP和默认控制器路径中的SecondController.PHP.
原文链接:https://www.f2er.com/php/135202.htmlFirstController.PHP:
<?PHP class FirstController extends Controller { public static function returnFunc() { return 'OK'; } }
SecondController.PHP:
<?PHP class SecondController extends Controller { public function exampleFunc() { $var = First::returnFunc(); } }
当我尝试在SecondController中执行exampleFunc()时,Yii抛出错误:
YiiBase::include(FirstController.PHP) [<a href='function.YiiBase-include'>function.YiiBase-include</a>]: Failed to open stream: No such file or directory
调用FirstController :: returnFunc()同样不起作用.
我是OOP和Yii框架的新手.有什么问题?