/**
* Obtain the physical (MAC) address of the machine's network card
* Currently supports WIN/LINUX system
**/
class MacAddInfo {
var $return_array = array (); // Return a string array with MAC address
var $mac_addr;
function MacAddInfo($os_type) {
switch ( strtolower ( $os_type )) {
case "linux" :
$this->forLinux ();
case "solaris" :
break; unix" :
break;
case "aix" :
break;
default :
$this-&g t;forWindows ();
break; $temp_array = array (); :-]" . "[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 )) {
unset ( $temp_array );
return $this->mac_addr;
if ($this->return_array)
return $this->return_array;
else {
$ipconfig = $_SERVER ["WINDIR"] . " ;
if (is_file ( $ipconfig ))
@exec ( $ipconfig . " /all", $this->return_array ); $_SERVER ["WINDIR" ] . "/system/ipconfig.exe /all", $this->return_array );
return $this-> {
@exec ( "ifconfig -a", $this->return_array );
return $this->return_array;
}
}
//Calling example
//$mac = new MacAddInfo(PHP_OS);
//echo $mac->mac_addr;
?>
http://www.bkjia.com/PHPjc/621689.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/621689.htmlTechArticleThe php code shared in this section has the main function: Get the physical (MAC) address of the machine's network card. Code: Copy the code The code is as follows: ?php /** * Get the physical (MAC) address of the machine's network card * Currently...