gpt4 book ai didi

php - cakePHP 非法偏移类型

转载 作者:可可西里 更新时间:2023-11-01 08:36:46 24 4
gpt4 key购买 nike

我是 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 行]

这是它显示的代码/上下文 如果($类型!=='全部'){ 如果 ($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

最佳答案

我建议您按照

上的最新教程进行操作

http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html

因为您使用的是 cakephp 2.1,所以应该完全遵循您的设置。您现在尝试关注的是针对 cakephp1.2 的,写于 2007 年,所以我怀疑它是否对您有用。

关于php - cakePHP 非法偏移类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9809397/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com