我在我的Yii應用程序中創建了2個控制器:FirstController.php和SecondController.php在默認控制器路徑中。在Yii的另一個控制器中調用函數
FirstController.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
調用相似不工作。
我是OOP和Yii框架中的newbee。有什麼問題?
http://www.yiiframework.com/forum/index.php/topic/6471-call-another-controllers-action/#entry200141 – 2014-01-31 06:58:03