- 论坛徽章:
- 0
|
同样的一段代码,在我的pc上(xampp/php5.3.8/apache2)和虚拟机(linux/xampp/php5.3.8/apache2)上运行的结果一致,但到了服务器上(centos5.5/php5.3.16/nginx)得到的结果与本机不一致,导致后面的逻辑都错了,不知道问题在哪里:
$user = $this->Login->find('first',array('conditions'=>array(
'Login.username = '=>$username,
'Login.password = '=>$password
)));
这是一段判断登录的逻辑,在后面的代码中是用$user['Login']来判断的,在我PC和虚拟上能取到$user['Login']的正确值,print_r出来后:
Array ( [Login] => Array ( [id] => 9 [username] => aaaaaa [password] => 04b35cf604476680b22c4bb8b0888e4a [created] => 2012-08-03 10:13:38 [groupid] => 10 [status] => 1 [lastlogintime] => 2012-08-03 10:14:07 [lastloginip] => 192.168.12.78 [logincount] => 2 ) )
但代码放到服务器上就行不通了,登录老进不去,print_r($user)后:
Array ( [0] => Array ( [id] => 9 [username] => aaaaaa [password] => 04b35cf604476680b22c4bb8b0888e4a [created] => 2012-08-03 10:13:38 [groupid] => 10 [status] => 1 [lastlogintime] => 2012-08-03 10:14:07 [lastloginip] => 192.168.12.78 [logincount] => 2 ) )
由Key为Login直接变成下标数组了,代码里的$user['Login']自然无效了。。。。
震惊了。。。这问题出在哪? |
|