laravel
如下已经获取到的对象
{#293
+"iss": "http://example.org"
+"aud": "http://example.com"
+"iat": 1356999524
+"nbf": 1357000000
+"user_id": "1"
}
先需要取出user_id,讲对象转换成数组形式
示例如下
$userId = json_decode(json_encode($userId),true);
打印转换后的数组
array:5 [
"iss" => "http://example.org"
"aud" => "http://example.com"
"iat" => 1356999524
"nbf" => 1357000000
"user_id" => "1"
]
现就可以去出user_id
thinkphp
get_object_var($object),返回一个数组。获取$object对象中的属性,组成一个数组
$id = get_object_vars($val['_id']);
至此结束