我开发了一款使用2种语言的脸书应用程序。法语&荷兰人。 (专注于荷兰语,荷兰语比利时语和法语比利时语。)
不知何故,当我将测试帐户放入法语时,它仍以荷兰语显示。
我有这个应用程序的代码
<?php
require 'facebook.php';
$app_id = "xxx";
$app_secret = "xxx";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$signed_request = $facebook->getSignedRequest();
$page_id = $signed_request["page"]["id"];
$page_admin = $signed_request["page"]["admin"];
$like_status = $signed_request["page"]["liked"];
$country = $signed_request["user"]["country"];
$locale = $signed_request["user"]["locale"];
$languageFR = $signed_request["user"]["fr_FR"];
if ($like_status) {
if ($languageFR) {
include("fans_french.php");
}
else {
include("fans_dutch.php");
}
}
else {
if ($languageFR) {
include("nonfans_french.php");
}
else {
include("nonfans_dutch.php");
}
}
?>
谁会帮助我?
答案 0 :(得分:1)
尝试
<?php
require 'facebook.php';
$app_id = "xxx";
$app_secret = "xxx";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$signed_request = $facebook->getSignedRequest();
$page_id = $signed_request["page"]["id"];
$page_admin = $signed_request["page"]["admin"];
$like_status = $signed_request["page"]["liked"];
$country = $signed_request["user"]["country"];
$locale = $signed_request["user"]["locale"];
if ($like_status) {
if ($locale == "fr_FR") {
include("fans_french.php");
}
else {
include("fans_dutch.php");
}
}
else {
if ($locale == "fr_FR") {
include("nonfans_french.php");
}
else {
include("nonfans_dutch.php");
}
}
?>
签名请求IMHO中没有$signed_request["user"]["fr_FR"]
字段,请参阅https://developers.facebook.com/docs/reference/login/signed-request/