Page 1 of 1

好无聊,写了个程序玩玩..根据访问者的游览器,重新定向中文网页或者非中文网页.

Posted: 2008-09-04 11:16
by textilebbs

Code: Select all



<?


function get_lang()
{
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
   $lang=$_SERVER['HTTP_ACCEPT_LANGUAGE'];

   $lang2=strtok($lang,",");
   
 }
 

return $lang2;
 


}


function transf()
{
$target_lang=get_lang();

if ($target_lang=="zh-cn")
   {
   
   echo "<script>window.location =\"http://www.textilebbs.com/index.html\";</script>";
  //改成你想转到的中文页面
   }
else
   {
   
   echo "<script>window.location =\"http://www.textilebbs.com/index.php\";</script>";
   //改成你想转到的英文页面
   }
   
   

}

transf()
?>



[/size]