致命错误:无法在第781行的AuthComponent.php中取消设置字符串偏移

时间:2014-08-28 16:28:20

标签: cakephp-2.5

  

错误:无法取消设置字符串偏移
  文件:/var/www/lib/Cake/Controller/Component/AuthComponent.php
  行:781

代码:

if (isset($this->request->data['User'])) { $this->Auth->login(); }

知道这个错误发生的原因吗?

1 个答案:

答案 0 :(得分:0)

AppController.php内部

public $components = array(
    'Session',
    'Auth' => array(
        'loginRedirect' => array(
            'controller' => 'pages',
            'action' => 'display',
            'home'
        ),
        'logoutRedirect' => array(
            'controller' => 'pages',
            'action' => 'display',
            'home'
        ),
        'authError' => 'You must be logged in to view this page.',
        'loginError' => 'Invalid Username or Password.',
        'authenticate' => array(
            'passwordHasher' => 'Blowfish',
        )
    )
);

身份验证需要

'authenticate' => array(
    'Form' => array(
        'passwordHasher' => 'Blowfish',
    )
)