【发布时间】:2016-10-02 08:10:55
【问题描述】:
目前我正在使用 php geoip_country_code_by_name 函数从如下所示的数组中为不同国家/地区提供不同的内容:
<?php
$content = array(
'GB' => array(
'meta_description' => "Description is here",
'social_title' => "Title here",
'country_content_js' => "js/index.js",
),
'BR' => array(
'meta_description' => "Different Description is here",
'social_title' => "Another Title here",
'country_content_js' => "js/index-2.js",
),
);
?>
但我只有巴西和英国的特定内容。我希望为访问该页面的任何其他国家/地区提供与 BR 和 GB 不同的默认内容数组。
有没有办法创建一个规则,为我的数组中未指定的任何国家/地区提供一组默认内容?
【问题讨论】:
-
你可以有一个默认条目。通过引用您想要的默认值来分配它/
-
@atoms 我如何“通过引用分配它”?
-
我不确定,我想我可能有一个问题要问自己。我将回答这个关于如何没有