Yii2 后台登陆页面显示空白 [ 2.0 版本 ]
后台login 控制器:
<?php
namespace app\modules\admin\controllers;
use yii\web\Controller;
use app\models\LoginForm;
class LoginController extends Controller {
public function actionIndex() {
$model = new LoginForm();
$this->render('index', ['model'=>$model]);
}
}
view 模块:
<?php
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model app\models\LoginForm */
$this->title = 'Login';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="site-login">
<h1><?= Html::encode($this->title) ?></h1>
<p>Please fill out the following fields to login:</p>
<?php $form = ActiveForm::begin([
'id' => 'login-form',
'options' => ['class' => 'form-horizontal'],
'fieldConfig' => [
'template' => "{label}\n<div class=\"col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>",
'labelOptions' => ['class' => 'col-lg-1 control-label'],
],
]); ?>
<?= $form->field($model, 'username') ?>
<?= $form->field($model, 'password')->passwordInput() ?>
<?= $form->field($model, 'rememberMe', [
'template' => "<div class=\"col-lg-offset-1 col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>",
])->checkbox() ?>
<div class="form-group">
<div class="col-lg-offset-1 col-lg-11">
<?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>
访问http://localhost/basic/web/index.php?r=admin/login/index
, 页面显示空白,
log里最后一message为:
3 16:11:28.730 info yii\web\Session::open Session started
E:\phpEnv\yii2\basic\views\layouts\main.php (41)
E:\phpEnv\yii2\basic\modules\admin\controllers\LoginController.php (13)
amrozhou 补充于 2015-03-03 18:04
$this->render('index', ['model'=>$model]);
前加上 return 或 echo 就可以了=。=
共 0 个回答
没有找到数据。
amrozhou
注册时间:2015-02-25
最后登录:2021-06-03
在线时长:96小时32分
最后登录:2021-06-03
在线时长:96小时32分
- 粉丝26
- 金钱32351
- 威望40
- 积分33711