CAKEPHP - 授权问题,登录页面无效

时间:2016-10-10 19:53:34

标签: cakephp

我在CakePHP中写了一个小脚本,但此刻我有一点问题。 我写了登录用户控制器

<div class="index large-4 medium-4 large-offset-4 medium-offset-4 columns">
    <div class="panel">
        <?= $this->Form->create(); ?>
            <?= $this->Form->input('email'); ?>
            <?= $this->Form->input('password', array('type' => 'password')); ?>
            <center><?= $this->Form->submit('Zaloguj', array('class' => 'button')); ?></center>
        <?= $this->Form->end(); ?>
    </div>
</div>

登录CTP:

public function initialize()
{
    parent::initialize();

    $this->loadComponent('RequestHandler');
    $this->loadComponent('Flash');
    $this->loadComponent('Auth', [
            'autheticate' => [
                'Form' => [
                    'fields' => [
                        'username' => 'email',
                        'password' => 'password'
                    ]
                ]
            ],
            'loginAction' => [
                'controller' => 'Users',
                'action' => 'login'
            ]
        ]);
}

APPController(授权的一部分):

        dump($this->Auth->user('email'));
        die();

我试着这样做:

{{1}}

但是在我的屏幕上我得到了&#39; null&#39;。

有人知道我做错了什么吗? 谢谢。

0 个答案:

没有答案
相关问题