今天在调用方法时,发现返回值为:object,导致不能通过数组方式取值,捣鼓半天才知道这么取;
print_r(object);
(
[items:protected] => Array
(
[0] => stdClass Object
(
[user_id] => 488579
[user_type] => 1
[sex] => 1
[nick] => 自动化专用五
[phone] => 13111111115
)
[1] => stdClass Object
(
[user_id] => 494385
[user_type] => 1
[sex] => 1
[nick] => 123
[phone] => 15111111111
)
)
)
例:取第一组数据中 user_type
的值
$user_type = $object[0]->user_type;
@阴-2016-12-06 18:14:52
网友评论