[英]ezSQL Object(stdClass) Cannot use object of type stdClass as array
$db = new ezSQL_mysql($user,$pass,$db,$server);
$user = $db->get_row("SELECT id,last FROM users WHERE email='$email'");
var_dump($user);
The dump returns this: 转储返回以下内容:
object(stdClass)#11 (5) {
["id"]=>
string(1) "4"
["last"]=>
string(19) "2013-01-06 14:48:24"
}
However, in attempting to ask for the id of the user via the object: 但是,在尝试通过对象询问用户ID时:
$uid=$user->id;
I get this error: 我收到此错误:
Cannot use object of type stdClass as array
I fixed my own problem by eding the class and pushing get_object_vars: 我通过编辑类并推送get_object_vars解决了自己的问题:
if ( $output == OBJECT )
{
$out = $this->last_result[$y]?$this->last_result[$y]:null;
return get_object_vars($out);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.