最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

PHP獲取MAC地址的函數(shù)代碼

 更新時(shí)間:2011年09月11日 20:29:15   作者:  
獲取網(wǎng)卡的MAC地址原碼;目前支持WIN/LINUX系統(tǒng) 獲取機(jī)器網(wǎng)卡的物理(MAC)地址

復(fù)制代碼 代碼如下:

<?php
/**
獲取網(wǎng)卡的MAC地址原碼;目前支持WIN/LINUX系統(tǒng)
獲取機(jī)器網(wǎng)卡的物理(MAC)地址
**/
class GetMacAddr{
var $return_array = array(); // 返回帶有MAC地址的字串?dāng)?shù)組
var $mac_addr;
function GetMacAddr($os_type){
switch ( strtolower($os_type) ){
case "linux":
$this->forLinux();
break;
case "solaris":
break;
case "unix":
break;
case "aix":
break;
default:
$this->forWindows();
break;
}
$temp_array = array();
foreach ( $this->return_array as $value ){
if (
preg_match("/[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f]/i",$value,
$temp_array ) ){
$this->mac_addr = $temp_array[0];
break;
}
}
unset($temp_array);
return $this->mac_addr;
}
function forWindows(){
@exec("ipconfig /all", $this->return_array);
if ( $this->return_array )
return $this->return_array;
else{
$ipconfig = $_SERVER["WINDIR"]."\system32\ipconfig.exe";
if ( is_file($ipconfig) )
@exec($ipconfig." /all", $this->return_array);
else
@exec($_SERVER["WINDIR"]."\system\ipconfig.exe /all", $this->return_array);
return $this->return_array;
}
}
function forLinux(){
@exec("ifconfig -a", $this->return_array);
return $this->return_array;
}
}
//方法使用
//$mac = new GetMacAddr(PHP_OS);
//echo $mac->mac_addr;
?>

相關(guān)文章

最新評(píng)論

江川县| 绥中县| 金门县| 民乐县| 浏阳市| 江阴市| 岑巩县| 山东| 桐乡市| 涿州市| 墨脱县| 崇礼县| 文化| 朔州市| 宁波市| 赣州市| 南皮县| 江门市| 左云县| 天峻县| 城步| 临沂市| 金平| 宁南县| 城固县| 紫金县| 长兴县| 南开区| 广东省| 淳安县| 大厂| 鄂伦春自治旗| 纳雍县| 黄山市| 汽车| 航空| 方正县| 新邵县| 舞阳县| 壤塘县| 湟中县|