为Yii2网站添加新视图页面时出错

时间:2016-10-24 04:56:15

标签: model-view-controller yii2 yii2-basic-app

我刚刚回来了Yii2和php。我尝试做的是使用名为login.php的Yii2在我的网站中添加新的视图页面,但似乎没有正确读取。我在我的控制器中添加了actionLogin,并且在views文件夹中也可以看到login.php。我错过了什么吗?

我正在使用MainController.php来显示它

<?php

namespace app\controllers;

use Yii;
use app\models\Basic;
use app\models\BasicSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;

/**
 * BasicController implements the CRUD actions for Basic model.
 */
class MainController extends Controller
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['POST'],
                ],
            ],
        ];
    }

    /**
     * Lists all Basic models.
     * @return mixed
     */
    public function actionIndex()
    {
        return $this->render('index', [
        ]);
    }

    public function actionLogin()
    {
        return $this->render('login', [
        ]);
    }
}

login.php看起来像这样:

<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\Pjax;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;


$this->title = Yii::t('app', 'Basics');
$this->params['breadcrumbs'][] = $this->title;

?>

LOGIN

enter image description here

0 个答案:

没有答案