如何从对象访问私有值

时间:2015-11-14 04:43:46

标签: yii2

我有以下对象



[yii\authclient\clients\Twitter_ef71f520786335688cd762d29aaa2ac98b6bd42f_token] => yii\authclient\OAuthToken Object
        (
            [tokenParamKey] => oauth_token
            [tokenSecretParamKey] => oauth_token_secret
            [createTimestamp] => 1447473086
            [_expireDurationParamKey:yii\authclient\OAuthToken:private] => 
            [_params:yii\authclient\OAuthToken:private] => Array
                (
                    [oauth_token] => 48575497-RTIItaMJBC5LrFl0I2TjYw0ihByC0QuRdRxf44tVX
                    [oauth_token_secret] => IcdvTgwiclWGNhX4TrsDjEkEdNwVF7l1XzXmgpNstGfkV
                    [user_id] => **********
                    [screen_name] => ***********
                    [x_auth_expires] => 0
                )

        )




并在上面的对象中,我想访问oauth_token

下的参数oauth_token_secret_params:yii\authclient\OAuthToken:private

如何在php中获取这些值?

1 个答案:

答案 0 :(得分:0)

https://github.com/yiisoft/yii2-authclient/blob/master/OAuthToken.php#L86

yii\authclient\OAuthToken有公开方法getParams()getParam($name)