PHP判断浏览器,判断语言代码共享

PHP判断浏览器,判断语言代码共享
PHP编程中经常需要使用一些多个服务器的数据,尤其是_server美元的详细参数,方便以后使用。

判断浏览器的类型

复制代码代码如下所示:

/判断

< PHP

如果(strpos($ _server { }http_user_agent ,MSIE 8)))

Internet Explorer 8;

如果(strpos($ _server { }http_user_agent ,MSIE 7)))

Internet Explorer 7;

如果(strpos($ _server { }http_user_agent ,MSIE 6)))

Internet Explorer 6;

如果(strpos($ _server {http_user_agent},火狐 / 3 ))

火狐3;

如果(strpos($ _server {http_user_agent},火狐 / 2 ))

火狐2;

如果(strpos($ _server { }http_user_agent ,铬))

回声眉目传情铬;

如果(strpos($ _server { }http_user_agent ,狩猎))

回声Safari;

如果(strpos($ _server { }http_user_agent ,歌剧))

回声歌剧;

其他_server { echohttp_user_agent};

>
判断语言

复制代码代码如下所示:

< PHP

$郎= substr($ _server { 'http_accept_language},0, 4); / /只取前4名,只有确定最优先的语言。如果前5位的是,EN和ZH的情况可能影响判断。

如果(preg_match( / /我zh-c

简体中文;

如果(preg_match( / /我ZH

回声繁体中文;

如果(preg_match( / EN /我

回声{英语};

如果(preg_match( / /我的FR

回声法语;

如果(preg_match( / /我

回声德语;

如果(preg_match( / /我的JP

回声日语;

如果(preg_match( / /我KO

回声韩文;

如果(preg_match( / /我的ES

回声西班牙语;

如果(preg_match( / /我的SV

回声{瑞典语};

其他_server { echohttp_accept_language};

>
以上是个人整理信息_server美元访问服务器的信息,我希望你能喜欢它。

tag:浏览器语言代码电脑软件php

相关内容