class SomeController extends Controller
{
public function actionIndex() {
echo 'This is some controller';
}
}
class AnotherController extends SomeController
{
public function actionIndex() {
echo 'This is another controller';
}
}
这是有效的:
index.php?r=some
but ...
index.php?r=another
提示信息:
PHP警告
include(SomeController.php): 打开文件失败: 没有那个文件或目录
两个文件都在同一目录下。
test\protected\controllers\
顺便提一下,过去我也尝试使用Gii Controller Generator以"SomeController"作为基类...
它显示:
The controller has been generated successfully. You may try it now.
Generating code using template
"C:\xampp\htdocs\yii\framework\gii\generators\controller\templates\default"...
generated controllers\YetAnotherController.php
generated views\yetAnother\index.php
done!
当我点击“立即尝试”时,它也显示:
PHP警告
include(SomeController.php):无法打开流:没有那个文件或目录