MAC (Media access control or medium access control) address, which is a translation of media access controls, or physical addresses, hardware addresses, to define the location of network devices. how to get the Mac(Media Access Control) address in PHP , see the following code:
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", $t His->return_array); return $this->return_array; }}//method using $mac = new Getmacaddr (php_os); echo $mac->mac_addr;?>
All rights reserved: Don't An Shu
This article link: http://www.bieanju.com/138.html
How to get the server MAC address in PHP development?