开发者

How do you append for example ?lang=en_US to the url based on a cookie containing country code?

I have a code like this that extract the country code saved in the cookie.

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

                    $language = "eng";

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

Now I need to append the language from the $supported_locales = a开发者_JAVA技巧rray('en_US', 'no_NO');

and append it to the url so it looks like this http://localhost/site/test.php?lang=no_NO

How do I do that?


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

or

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜