我有一个基于 url 的简单数组,即 www.example.com/apple/ 它放置在我需要它的苹果文本中 - 但我还需要一个选项,根据品牌。
IE,所以我可以使用 $brand_to_use 来绘制它以放置在“apple”中,例如 $brandurl_to_use 在我需要的地方绘制在“apple.co.uk”中,但我不确定如何根据原创品牌。
谢谢
$recognised_brands = array(
"apple",
"orange",
"pear",
// etc
);
$default_brand = $recognised_brands[0]; // defaults brand to apple
$brand_to_use = isset($_GET['brand']) && in_array($_GET['brand'], $recognised_brands)
? $_GET['brand']
: $default_brand;
伪代码更新示例:
recognised brands =
apple
orange
pear
default brand = recognised brand 0
recognised brandurl =
apple = apple.co.uk
orange = orange.net
pear = pear.com
the brandurl is found from the recognised brands so that in the page content I can reference
brand which will show the text apple at certain places +
brandurl will show the correct brand url related to the brand ie apple.co.uk