问题
I am using oauth to connect facebook with my app
token = $fb->requestAccessToken( $code );
will give following
OAuth\OAuth2\Token\StdOAuth2Token Object
(
[accessToken:protected] => CAAIYQeqXeLYBAIlu6fiQKudu0XQxdCya33PC0cEAZCFDQNkV1KCCZBuOEmXyhkv5VU45kU0pDwSCYoVzLBc7AbHti81mVq9xBgMygA2oLfVArqxboRO1QzgSSCcqqgwZA3nszCmVx6M5MHVXYZBB6g1KpWukRbHWyhVxWUzNWzs81MS3ERiMNK6ZAsYRS9zhYNZABZCTh8SK89tYNGOBuwC
[refreshToken:protected] =>
[endOfLife:protected] => 1411197432
[extraParams:protected] => Array
(
)
)
whenever i try to access accessToken
like below
print_r($token->accessToken);
It gives the following error
Cannot access protected property OAuth\OAuth2\Token\StdOAuth2Token::$accessToken
it seems simpler but i am not able to access accessToken
.
Any clues?
回答1:
A getter should exist. Try : $token->getAccessToken());
来源:https://stackoverflow.com/questions/24885438/cannot-access-protected-property-laravel-4