2012-04-11 3 views
1

나는 이것을 파싱하는 데 어려움을 겪고 있습니다. 나는이 일을 통해 access_credentials에 키를 얻는 방법을 알고있다 : $ account [ 'twitter'] -> access_credentials ;.PHP에서이 반환 값을 구문 분석하는 방법

하지만 oauth_token 또는 oauth_token_secret을 가져올 수 없습니다. 이것을 세션 변수에 저장할 수 있도록해야합니다.

[twitter] => stdClass Object 
    (
     [id] => 1 
     [third_party_uid] => 
     [access_credentials] => {"oauth_token":"xxxx","oauth_token_secret":"xxx","user_id":"1234","screen_name":"user_1"} 
     [mds_user_id] => 15 
     [type] => 
     [provider] => Twitter 
    ) 

도와주세요.

+0

이 그것을 해결, 단지 결과를 json_decode에 필요한^_ ^ –

답변

5

JSON 문자열처럼 보입니다. 그것을 디코딩 :

$credentials = json_decode($account['twitter']->access_credentials, true); 
echo $credentials['oauth_token']; 
2
$ac = json_decode($twitter->access_credentials); 
echo $ac['oauth_token']; 
관련 문제