1

我按照这个项目的例子(example.php):https ://github.com/facebook/facebook-php-sdk

它运行得很好,我可以从 Facebook 帐户中检索很多信息(姓名、身份证、名字、姓氏、城市......)但我看不到用户电子邮件,这是我唯一需要的......

如何修改该页面以仅检索用户电子邮件?

谢谢!

4

2 回答 2

0

但我看不到用户电子邮件,这是我唯一需要的......

当用户登录您的应用程序时,您必须先请求email许可 - 请参阅https://developers.facebook.com/docs/authentication/permissions/

如何修改该页面以仅检索用户电子邮件?

After getting the permission, if you don’t want all the additional fields, use the fields parameter in your Graph API call, as in /me?fields=email (it’ll still give you the user id as well, but not any other info you might not need).

于 2012-09-22T13:43:06.167 回答
-1

您可以使用此代码获取电子邮件

function fqlQuerynew() {
           FB.api('/me', function (response) {
                var query = FB.Data.query('select name,email,hometown_location, sex, pic_square from user where uid={0}', response.id);
                query.wait(function (rows) {
                    alert(rows[0].name);
                     alert(rows[0].email);
                     alert(rows[0].sex);
                     alert(rows[0].pic_square);
                });
            });
        }
于 2012-09-21T19:06:27.580 回答