christopherfouquier / facebook
将Facebook SDK集成到php
dev-master
2015-01-04 00:23 UTC
Requires
- php: >=5.3.0
- facebook/php-sdk-v4: 4.0.*
This package is not auto-updated.
Last update: 2024-09-28 16:15:29 UTC
README
将Facebook SDK集成到php
- 认证
- 权限管理
安装
使用composer将facebook添加到依赖项
php composer.phar require "christopherfouquier/facebook":"dev-master"
参数
- appId : 应用程序ID
- appSecret : 应用程序密钥
- redirectUrl : 重定向URL
- permissions : 需要用于应用程序的FacebookOAuth权限数组
使用方法
类调用
use facebook\Facebook;
我们开始会话
session_start();
类被实例化
$facebook = new Facebook(
"xxx",
"xxx"
);
它检索登录URL。
$url = $facebook->connect();
它检查用户是否已认证。
if (isset($_SESSION['fb_token']) && $_SESSION['fb_token'] != null) {
// Connected
}
else {
echo "<a href='". $url ."'>Connection from facebook</a>";
}
待办事项
- 添加功能