我正在测试我的web应用程序,它使用了Facebook。我从其他帖子中看到,用户可以在“唯一名称”字段中选择他们想要显示的名称。这是真的吗?
我的名字可以有两种语言:英文和中文。但是当我测试我的应用程序时,它有时使用我的中文版本,但当我重新加载时,它总是显示英文版.
PHP:
$user = $facebook->getUser();
$user_profile = $facebook->api('/'.$user);
//the line was: $user_profile = $facebook->api('/me');
//name was always English back then
//but it cause the expired token problem
$username = $user_profile['first_name'] . " " . $user_profile['last_name'];
echo $username;产出有时:
志榮 張 //By the way, the Chinese name suppose to be 張志榮产出通常是:
Daniel Cheung为什么是这样?因为显示的名称将被记录下来,所以数据看起来非常不一致,很难用我的数据库来处理。
我能告诉Facebook只发英文名字吗?因为当人们使用英文版本的Facebook时,他们会看到我的英文名字。中文Facebook总是显示我的中文名字。
发布于 2014-08-26 07:00:39
您可以向图形API请求传递一个locale参数。看一下
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.1#readmodifiers
这样,您至少应该能够检索一致的结果。
https://stackoverflow.com/questions/25498451
复制相似问题