简体   繁体   English

使用$ _SESSION ['fb _'。APP_ID .'_ user_id']

[英]using $_SESSION['fb_'.APP_ID.'_user_id']

I'm developing a fb application with php sdk 3.0 and I've noticed that Facebook starts a session that contain the app_ID like that: $_SESSION['fb_'.APP_ID.'_user_id']; 我正在用php sdk 3.0开发一个fb应用程序,并且我注意到Facebook启动了一个包含app_ID的会话,如下所示: $_SESSION['fb_'.APP_ID.'_user_id']; This session store the facebook uid of the connected user. 该会话存储连接用户的facebook uid。 Is this a feature of PHP SDK or is not recommended to work with this session? 这是PHP SDK的功能还是不建议在此会话中使用?

To explain: After login successfully to my fb app, I use this function to see the php sessions print_r($SESSION); 解释:成功登录我的fb应用程序后,我使用此函数查看php会话print_r($SESSION); and there is a session $_SESSION['fb_173620963485_user_id'] = 123456; 并存在一个会话$_SESSION['fb_173620963485_user_id'] = 123456; WHERE 173620963485 is my appID and 123456 is my fb uid. 173620963485是我的appID,123456是我的fb uid。

Is recommended to work with this session: $_SESSION['fb_173620963485_user_id'] ? 建议与以下会话一起使用: $_SESSION['fb_173620963485_user_id']吗?

You don't use this session for anything. 您不会将此会话用于任何事情。 Period. 期。

You should never need to touch the $_SESSION['fb_..._user_id'] variable. 您永远不需要触摸$_SESSION['fb_..._user_id']变量。 Use the SDK like the documentation states and you will be much better off. 像文档说明中所述使用SDK,您会更好。 If you want access to the user ID, just use: 如果要访问用户标识,请使用:

$uid = $facebook->getUser();

Take the time and read the documentation , and that should help. 花时间阅读文档 ,这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM