//原作者: epsilon7
//SonyMusic(sonymusic@163.net)
class BrowserDetector {
var $UA = "" //$HTTP_USER_AGENT
varの内容 $BROWSER= "Unknown"; //ブラウザの種類
var $PLATFORM = "不明"; //オペレーティング システム
var $VERSION= ""; //ブラウザのバージョン番号
var $MAJORVER = "";バージョン番号
/* コンストラクターの開始*/
function BrowserDetector(){
$this->UA = getenv(HTTP_USER_AGENT);
$parens = ""; this->UA,"(");
if ($i >= 0) {
$preparens = trim(substr($this->UA,0,$i)); $this->UA,$i+1,strlen($this->UA));
$j = strpos($parens,")");
if($j>=0) {
$parens = substr($parens,0,$j);
}
}
else {
$preparens = $this->UA;
$browVer = $preparens; ";"));
while($token) {
if($token=="互換性") {
}
elseif(preg_match("/MSIE/i","$token")) {
$browVer = $token;
}
elseif(preg_match("/Opera/i","$token")) {
$browVer = $token;
}
elseif(preg_match("/X11/i"," $token") || preg_match("/SunOS/i","$token") || preg_match ("/Linux/i","$token")) {
$this->PLATFORM = "Unix"; (preg_match("/Win/i","$token")) {
$this->PLATFORM = $token;
}
elseif(preg_match("/Mac/i","$token" ) || preg_match ("/PPC/i","$token")) {
$this->PLATFORM = $token;
}
$msieIndex = strpos ($browVer, "MSIE");
if($msieIndex >= 0) {
$browVer = substr($browVer,$msieIndex,strlen($browVer));
$leftover = ""; browVer,0,strlen("Mozilla")) == "Mozilla") {
$this->BROWSER = "Netscape";
$leftover=substr($browVer,strlen("Mozilla")+ 1,strlen( $browVer));
}
elseif(substr($browVer,0,strlen("Lynx")) == "Lynx") {
$this->BROWSER = "Lynx"; browVer,strlen("Lynx")+1,strlen($browVer));
}
elseif(substr($browVer,0,strlen("MSIE")) == "MSIE") {
$ this->ブラウザ = "IE";
$leftover=substr($browVer,strlen("MSIE")+1,strlen($browVer));
}
elseif(substr($browVer,0,strlen("Microsoft Internet Explorer") )) == "Microsoft Internet Explorer") {
$this->BROWSER = "IE"
$leftover=substr($browVer,strlen("Microsoft Internet Explorer")+1,strlen($ browVer);
}
elseif(substr($browVer,0,strlen("オペラ")) == "オペラ") {
$this->BROWSER = "オペラ";
$leftover=substr($browVer ,strlen(" Opera")+1,strlen($browVer));
}
$leftover = トリム($leftover);
$i=strpos($leftover," ");
if($i > 0 ) {
$ this->VERSION = substr($leftover,0,$i);
http://www.bkjia.com/PHPjc/509060.html
www.bkjia.com
true
http://www.bkjia.com/PHPjc/509060.html
技術記事
//原作者: epsilon7 //SonyMusic(sonymusic@163.net) class BrowserDetector var UA = ""; //HTTP_USER_AGENT の内容 var BROWSER= "Unknown" //ブラウザの種類 var PLATFORM = "Unknown...