保存来自 facebook open id 的信息
我正在做一个项目,其中用户通过注册网站以及使用 Facebook 登录信息来登录。 我可以使用 facebook 登录信息登录,但我如何保存用户的信息,以便他下次登录 该网站将显示他的信息(就像在 stackoverflow 中一样)。我正在使用 PHP-smarty。
print_r($_SESSION)
是
Array
(
[fb_117743971608120_state] => 9cec0afaeea766a4c604308d750cae27
[fb_183884308338472_code] => 085FCZlNVcOmjOb5-oejUDGSXEypJf6K5gOGCUjbFDg.eyJpdiI6Ii1nODJpOWFuZHh0bUh4VzNVc3d3OEEifQ.1DvUVqsbPFAhK9lgOYvwBH9qrpQkjYhbA9s8nVxCgnefVyGQX3KjSSCEiN1Rs0GfnGqgwYESDuPlDjEpPRGhkK5kn4U4CExgm22URCr45EM44vjL5wEFyT8WbWzPoE0_tYSkHgmEc5TPNBP1GB1z-g
[fb_183884308338472_access_token] => 183884308338472|2.AQB3ExZ8y5FeCiR5.3600.1310461200.1-100000525094244|JxU5yIl32MnS2jWuci_p6qllPEI
[fb_183884308338472_user_id] => 100000525094244
)
I am doing a project in which user cal log in by registering to the site as well as using facebook login information .
I am able to log in using facebbook login information but how will I save the information of the user so that next time he logs in
the site will show his information (like in stackoverflow) . I am using PHP - smarty .
print_r($_SESSION)
is
Array
(
[fb_117743971608120_state] => 9cec0afaeea766a4c604308d750cae27
[fb_183884308338472_code] => 085FCZlNVcOmjOb5-oejUDGSXEypJf6K5gOGCUjbFDg.eyJpdiI6Ii1nODJpOWFuZHh0bUh4VzNVc3d3OEEifQ.1DvUVqsbPFAhK9lgOYvwBH9qrpQkjYhbA9s8nVxCgnefVyGQX3KjSSCEiN1Rs0GfnGqgwYESDuPlDjEpPRGhkK5kn4U4CExgm22URCr45EM44vjL5wEFyT8WbWzPoE0_tYSkHgmEc5TPNBP1GB1z-g
[fb_183884308338472_access_token] => 183884308338472|2.AQB3ExZ8y5FeCiR5.3600.1310461200.1-100000525094244|JxU5yIl32MnS2jWuci_p6qllPEI
[fb_183884308338472_user_id] => 100000525094244
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有使用过 Facebook 登录,但我假设它的操作方式与任何其他登录类似。也就是说,您需要使用某种可在访问者返回时使用的持久结构。
例如:
您还可以查看cookie。请注意,上面的代码没有经过测试,我只是在凌晨 2 点输入它,所以我很有可能错过了一些东西。查看 Sessions 和 Cookie。
I haven't worked with Facebook logins, but I am going to presume that it operates in a similar fashion to any other login. That is, you'll need to utilize some sort of persistent structure that can be utilized on a visitors return.
For instance:
You may also take a look at cookies. Please note that the above code was not tested, I just typed it out and its 2AM so there is a very real chance I missed something. Take a look at the documentation for Sessions and Cookies.