0

我正在使用 twitter oauth 功能进行登录。我从$client = $token->getHttpClient($config)方法中得到以下对象:

Zend_Oauth_Client Object
(
    [_config:protected] => Zend_Oauth_Config Object
        (
            [_signatureMethod:protected] => HMAC-SHA1
            [_requestScheme:protected] => header
            [_requestMethod:protected] => POST
            [_version:protected] => 1.0
            [_callbackUrl:protected] => http://roomstayssvn.com/register/twittercallback
            [_siteUrl:protected] => http://twitter.com/oauth
            [_requestTokenUrl:protected] => 
            [_accessTokenUrl:protected] => 
            [_authorizeUrl:protected] => 
            [_consumerKey:protected] => b04fuaxLR2d035FN8tTkQ
            [_consumerSecret:protected] => NGPPovdXDnSpivNoMNIgA609ZJIB8GVKGgs6yEF8A
            [_rsaPrivateKey:protected] => 
            [_rsaPublicKey:protected] => 
            [_token:protected] => Zend_Oauth_Token_Access Object
                (
                    [_params:protected] => Array
                        (
                            [oauth_token] => 299516752-tksjJZUR7Q2gwrDRDpLOLCrYhySTGWz1SBwTKcRU
                            [oauth_token_secret] => 7S9R2FLuB0GT4vvy0GerThUnpkbSTeSalURib48Sx20
                            [user_id] => 299516752
                            [screen_name] => jogkunal5
                        )
                 )
             .....
             ..... and so on

我想打印user_idscreen_name。我怎样才能打印它?

4

1 回答 1

4

以下应该工作

$user_id = $client->getToken()->getParam('user_id');
$screen_name = $client->getToken()->getParam('screen_name');

Zend_Oauth_Client::__call()代理Zend_Oauth_Config. Zend_Oauth_Config::getToken()返回Zend_Oauth_Token Zend_Oauth_Token::getParam()获取参数的值

从这里阅读文档。

最好使用支持 Zend 框架的好 IDE。

于 2013-01-09T11:54:44.400 回答