开发者

How to store data from facebook to local variable?

开发者 https://www.devze.com 2023-04-12 12:31 出处:网络
Im using the SDK 3 by facebook, and to store the facebook i开发者_Go百科d i am doing this: $facebook_id = $user;

Im using the SDK 3 by facebook, and to store the facebook i开发者_Go百科d i am doing this:

$facebook_id = $user;

Which works a treat! However... i cannot access individual items in the array, like i remember with the previous SDK you could do:

$first_name = $me['first_name'];

However, i have tried that, and $user['first_name'] and stuff but getting no where! I cant find any documentation of this either on their dev website or on the internet :/

Many thanks. Ian.


Seems like $user is just the Facebook User ID that you get through the authentication flow. If you want to get user info, you need to make a separate Graph call, like so:

$res = $facebook->api('/me');
$first_name = $res['first_name'];
0

精彩评论

暂无评论...
验证码 换一张
取 消