Facebook不会为用户返回电子邮件?

This is the code I'm using to get information from Facebook:

$fbUsrId  = $facebook->getUser();
$loginUrl = $facebook->getLoginUrl(
        array(
            'scope' => 'email'
        )
);

if ($fbUsrId) {
    $fbUsr = $facebook->api('/me');
    var_dump($fbUsr);
}

If I test in live it works fine, but from localhost Facebook returns only the user's name and email:

array (size=2)
  'name' => string 'xxx xxx' (length=18)
  'id' => string 'xxx' (length=15)

There may be two things here:

  1. The user needs to have granted your app the email permission.
  2. If you are using v2.4 of the Graph API then you should use the ?fields=field1,field2 syntax to declare all the fields you want the API to return. Which means you have to specify the fields explicitly like /v2.4/me?fields=name,email etc.