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
但 ...
index.php?r=another
说:
PHP 警告
包括(SomeController.php):无法打开流:没有这样的文件或目录
两个文件都在
test\protected\controllers\
顺便说一句,过去我也尝试使用带有“SomeController”作为基类的 Gii 控制器生成器......
它说:
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 警告
包括(SomeController.php):无法打开流:没有这样的文件或目录