Add this line to /config/main.php (or whatever config file you are using)
'import'=>array(
'application.models.*',
'application.controllers.*', <-- add this line
'application.components.*',
...
example I used in siteController
public function hello()
{
return 'Hello World';
}
proof that another controller can access the method
In another controller
public function actionIndex()
{
echo SiteController::hello();
die;
...
用以上方法无法获取到controller里面的方法,
把controller里的方法前加上static设为静态就可以了