简体   繁体   English

cakePHP非法偏移类型

[英]cakePHP illegal offset type

I'm new to cakephp and following this tutorial for a user authentication system 我是cakephp的新手,并且遵循本教程中的用户身份验证系统

http://bakery.cakephp.org/articles/SeanCallan/2007/04/17/simple-form-authentication-in-1-2-xx http://bakery.cakephp.org/articles/SeanCallan/2007/04/17/simple-form-authentication-in-1-2-xx

The only thing I changed is in the file login.ctp. 我唯一改变的是login.ctp文件。 I changed the pointers from 我改变了指针

 $form-> 

to

 $this->Form->

I'm getting two errors and I can't figure out why. 我有两个错误,我无法弄清楚原因。 Here is the first 这是第一个

Warning (2): Illegal offset type [CORE\\Cake\\Model\\Model.php, line 2603] 警告(2):非法偏移类型[CORE \\ Cake \\ Model \\ Model.php,第2603行]

This is the code/context it displays if ($type !== 'all') { if ($this->findMethods[$type] === true) { 这是它显示的代码/上下文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) {}

This information was also displayed 此信息也显示出来

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

Here is the second error 这是第二个错误

Warning (2): Illegal offset type [CORE\\Cake\\Model\\Model.php, line 2579] 警告(2):非法偏移类型[CORE \\ Cake \\ Model \\ Model.php,第2579行]

This is the code it displays 这是它显示的代码

   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) {}

Here is the additional information 这是附加信息

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

I would suggest you follow the more recent tutorial at 我建议你按照最近的教程进行操作

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

Which should follow your setup exactly since you are using cakephp 2.1. 因为你正在使用cakephp 2.1,所以应该完全遵循你的设置。 The one you are trying to follow now is for cakephp1.2 and was written on 2007 so I doubt it's going to be useful for you. 你现在要遵循的那个是cakephp1.2并且写于2007年,所以我怀疑它对你有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM