Cannot access protected property -laravel 4

无人久伴 提交于 2019-12-13 04:17:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!