PHP獲取訪問裝置資訊的方法示例

2022-09-26 06:30:12 字數 3266 閱讀 5448

<?php header("content:content-type:text/html;charset=utf-8");

// // 作用取得客戶端的ip、地理位置、瀏覽器、以及訪問裝置

class get_equipment_info

elseif (preg_match('/firefox/i',$br))elseif (preg_match('/chrome/i',$br))elseif (preg_match('/safari/i',$br))elseif (preg_match('/opera/i',$br))else

return json_encode("瀏覽器為".$br);

}else

}////獲得訪客瀏覽器語言

function getlang()

elseif(preg_match("/zh/i",$lang))else

return json_encode("瀏覽器語言為".$lang);

}else

}//獲取客戶端作業系統資訊包括win10

function getos()

else if (preg_match('/win 9x/i', $agent) && strpos($agent, '4.90'))

else if (preg_match('/win/i', $agent) && preg_match('/98/i', $agent))

else if (preg_match('/win/i', $agent) &程式設計客棧& preg_match('/nt 6.0/i', $agent))

else if (preg_match('/win/i', $agent) && preg_match('/nt 6.1/i', $agent))

else if (preg_match('/win/i', $agent) && preg_match('/nt 6.2/i', $agent))

else if(preg_match('/win/i', $agent) && preg_match('/nt 10.0/i', $agent))

else if (preg_match('/win/i', $agent) && preg_match('/nt 5.1/i', $agent))

else if (preg_match('/win/i', $agent) && preg_match('/nt 5/i', $agent))

else if (preg_match('/win/i', $agent) && preg_match('/nt/i', $agent))

else if (preg_match('/win/i', $agent) && preg_match('/32/i', $agent))

else if (preg_match('/linux/i', $agent))

else if (preg_match('/unix/i', $agent))

else if (preg_match('/sun/i', $agent) && pr程式設計客棧eg_match('/os/i', $agent))

else if (preg_match('/ibm/i', $agent) && preg_match('/os/i', $agent))

else if (preg_match('/mac/i', $agent) && preg_match('/pc/i', $agent))

else if (preg_match('/powerpc/i', $agent))

else if (preg_match('/aix/i', $agent))

else if (preg_match('/hpux/i', $agent))

else if (preg_match('/netbsd/i', $agent))

else if (preg_match('/bsd/i', $agent))

else if (preg_match('/osf1/i', $agent))

else if (preg_match('/irix/i', $agent))

else if (preg_match('/freebsd/i', $agent))

else if (preg_match('/teleport/i', $agent))

else if (preg_match('/flashget/i', $agent))

else if (preg_match('/webzip/i', $agent))

else if (preg_match('/offline/i', $agent))

else

return json_encode("系統為".$os);

} //獲得訪客真實ip

} // //根據ip獲得訪客所在地地名

function getaddress($ip = '')

$ipadd = file_get_contents("" . $ip); // 根據新浪api介面獲取

if ($ipadd) -\x]+/u", $charset, $ipadds);

return $ipadds; // 返回乙個二維陣列

} else

} //獲得本地真實ip

// function get_onlineip()

// else

// }

} // $info = new get_equipment_info();

// echo json_decode($info -> getlang());

// echo json_decode($info -> getos());

// json_decode($info -> getbrowser());

// print_r($info -> getaddress());

// echo $info -> getip();

// echo $info -> get_onlineip();

// die;

?>

php中獲取系統資訊的方法

root getenv document root 伺服器文件根目錄 port getenv server port 伺服器端口 file getenv script name 當前執行檔案 ua getenv http user agent 使用者ua method getenv request ...

php獲取系統資訊的相關方法

獲取系統型別及版本號 php uname 例 windows nt computer 5.1 build 2600 只獲取系統型別 php uname s 或 php os 例 windows nt 只獲取系統版本號 php uname r 獲取php執行方式 php sapi name php r...

ios 獲取裝置相關的資訊

1 獲取裝置的資訊 uidevice device uidevice alloc int nsstring name device.name 獲取裝置所有者的名稱 nsstring model device.name 獲取裝置的類別 nsstring type device.localizedmod...