PHP language detection

前端 未结 9 2248
陌清茗
陌清茗 2020-12-14 16:32

I\'m trying to build multilangual site.

I use this piece of code to detect users language. If you havent chosen a language, it will include your language file based

9条回答
  •  佛祖请我去吃肉
    2020-12-14 17:21

    if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
        $parts=explode(';',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
        $langs=explode(',',$parts[0]);
        var_dump($langs);
    }
    

提交回复
热议问题