How to get the language value from $_SERVER['HTTP_ACCEPT_LANGUAGE'] using PHP?

后端 未结 4 1922
野性不改
野性不改 2020-12-08 11:19

When I use Firefox to test this block of code, I get en-us,en;

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 12:21

    I just use explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']) to get the first possible language that my client might use. It works fine on chrome and IE 10. Not sure if it would be wrong on other browsers.

提交回复
热议问题