【发布时间】:2012-03-21 17:04:32
【问题描述】:
我是 cakephp 新手,并按照本教程学习用户身份验证系统
http://bakery.cakephp.org/articles/SeanCallan/2007/04/17/simple-form-authentication-in-1-2-x-x
我唯一更改的是文件 login.ctp。我从
更改了指针 $form->
到
$this->Form->
我遇到了两个错误,我不知道为什么。这是第一个
警告(2):非法偏移类型 [CORE\Cake\Model\Model.php,第 2603 行]
这是它显示的代码/上下文 if ($type !== 'all') { if ($this->findMethods[$type] === true) {
$type = array(
'username' => '',
'password' => '*****'
)
$query = array(
'conditions' => null,
'fields' => null,
'joins' => array(),
'limit' => null,
'offset' => null,
'order' => null,
'page' => (int) 1,
'group' => null,
'callbacks' => true,
(int) 0 => 'id',
(int) 1 => 'username'
)
$this = object(User) {}
也显示了此信息
Model::buildQuery() - CORE\Cake\Model\Model.php, line 2603
Model::find() - CORE\Cake\Model\Model.php, line 2562
User::validateLogin() - APP\Model\User.php, line 9
UsersController::login() - APP\Controller\UsersController.php, line 21
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE\Cake\Controller\Controller.php, line 484
Dispatcher::_invoke() - CORE\Cake\Routing\Dispatcher.php, line 104
Dispatcher::dispatch() - CORE\Cake\Routing\Dispatcher.php, line 86
[main] - APP\webroot\index.php, line 96
这是第二个错误
警告(2):非法偏移类型 [CORE\Cake\Model\Model.php,第 2579 行]
这是它显示的代码
return $results;
} else {
if ($this->findMethods[$type] === true) {
$type = array(
'username' => '',
'password' => '*****'
)
$query = array(
'conditions' => null,
'fields' => null,
'joins' => array(),
'limit' => null,
'offset' => null,
'order' => array(
),
'page' => (int) 1,
'group' => null,
'callbacks' => true,
(int) 0 => 'id',
(int) 1 => 'username'
)
$results = array(
(int) 0 => array(
)
)
$this = object(User) {}
这里是附加信息
Model::find() - CORE\Cake\Model\Model.php, line 2579
User::validateLogin() - APP\Model\User.php, line 9
UsersController::login() - APP\Controller\UsersController.php, line 21
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE\Cake\Controller\Controller.php, line 484
Dispatcher::_invoke() - CORE\Cake\Routing\Dispatcher.php, line 104
Dispatcher::dispatch() - CORE\Cake\Routing\Dispatcher.php, line 86
[main] - APP\webroot\index.php, line 96
【问题讨论】:
-
不,我应该检查一下。我正在运行2.1。从教程中获取代码以运行的任何建议?我对蛋糕很陌生,所以我觉得我要重新开始 php ......基本上我一无所知。