2010-07-19 43 views
0

我有这样的代码提取保存在cookie中的国家代码。如何在基于包含国家/地区代码的Cookie的基础上添加例如?lang = en_US的示例?

 if (isset($_COOKIE['country'])) 
      { 
       $country = $_COOKIE['country']; 

        $language = "eng"; 

       if ($country == "NO"){    
        $language = "nor"; 
        }      
       } 
      else 
      { 
      $language = "eng"; 
      } 

现在我需要从$supported_locales = array('en_US', 'no_NO');

追加语言,所以它看起来像这样http://localhost/site/test.php?lang=no_NO

我该怎么做,它追加到URL?

回答

1
header('Location: http://localhost/site/test.php?lang='.$language); 

echo '<script>location.href="http://localhost/site/test.php?lang='.$language.'"</script>'; 
相关问题