isLiked()在PHP的phpsdk4中没有返回任何内容

isLiked()在PHP的phpsdk4中没有返回任何内容

问题描述:

I have this problem. I was created facebook tab app application in developer fb, app I'm turn on.

I use this code. Unfortunately it doesn't work function isLiked(). Where is problem?

<?php
require 'phpsdk4/autoload.php';

use Facebook\FacebookSession;
use Facebook\FacebookPageTabHelper;

FacebookSession::setDefaultApplication('XXX', 'YYY');

$helper = new FacebookPageTabHelper();

echo '<p>page id: ' . $helper->getPageId() . '</p>';
echo '<p>liked: ' . $helper->isLiked() . '</p>';  
echo '<p>admin: ' . $helper->isAdmin() . '</p>';
?>

Function pageid and admin work correct. Unfortunately function isLiked() return nothing. Where is problem?

Thank you

Edit: I am try refresh page, if page like or not, however function return nothing.

If your application was created after August 7th 2014, the isLiked() parameter will no longer work as Facebook are disabling this functionality. The ability to see if a user likes a page will be completely removed on November 5th 2014.

From November 5th 2014, all apps will see liked = true, even if the user hasn't liked the page. Facebook is basically removing the ability to Likegate apps.

You can read more about this policy change here.