且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查用户是否已经喜欢 Facebook 页面?

更新时间:2023-12-01 18:56:16

如果您使用 facebook php API.我想出了这个简短的函数,你可以将它包含在 base_facebook.php 文件中到 BaseFacebook 类中.

If you use the facebook php API. i've came up with this short function that u can include inside the base_facebook.php file into the class BaseFacebook.

public function userIsFan() {
    $sr = $this->getSignedRequest();
    if($sr && is_array($sr)){
        if(array_key_exists('page', $sr)){
            return $sr['page']['liked'] == 1;
        }
    }
    return 0;
}