Home  >  Article  >  Backend Development  >  如何获取对象数组

如何获取对象数组

WBOY
WBOYOriginal
2016-06-23 14:24:58980browse

AccessToken Object ( [type] => MAC [accessToken] => 242762|2.4DBCPu7iaX2MYPnJOjpHHwEl6Dn98b3Y.561542950.1381995620216 [refreshToken] => [macKey] => a88084706e704bee912c8a3b5a215479 [macAlgorithm] => hmac-sha-1 ) 


我要如何获取accessToken的值


回复讨论(解决方案)

AccessToken->type

AccessToken->type
echo $obj->AccessToken->type;??
不对啊 

$obj=new AccessToken();
$obj->type;

$obj=new AccessToken();
$obj->type;
Fatal error: Class 'AccessToken' not found in F:\wamp\www\phpcms\test.php
照你这么写的报错啊
原本这是一串对象数组来的

你把代码贴出来,光贴个结果怎么猜?

如果是 print_r($obj); 得到你给出的结果
那么 $obj->accessToken 就是你你要的

$obj->accessToken

意思是AccessToken 是一个对象后面的数据是这个对象里的键值,你要取这个对象的值就是 对象名->键名

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn