我想在我的 PHP SilverStripe 站点中实现 Facebook 逻辑。如果用户已登录,我想显示一些文本,否则我想显示 FB 登录按钮。我该怎么做?
我尝试了一些东西:
<?php
class Page extends SiteTree
{
public static $db = array();
public static $has_one = array();
}
class Page_Controller extends ContentController
{
public static $allowed_actions = array();
public function init()
{
require 'facebook/src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'xxxxx',
'secret' => 'xxxxx',
'cookie' => true, // enable optional cookie support
));
$session = $facebook->getSession();
}
}
谢谢!