: This article describes how to obtain the MAC address, cpu serial number, and motherboard serial number through the windows system command wmic in PHP. if you are interested in the PHP Tutorial, refer to it. PHP obtains the MAC address, cpu serial number, and motherboard serial number through the windows system command wmic. the source code is as follows: class HardwareInfo {// obtains the MAC address function getMacAddress () {$ return_arry = array (); @ exec ("wmic nicconfig get macaddress", $ return_arry); $ mac_addr = $ return_arry [1]; $ mac_addr = str_replace (":", "", $ mac_addr ); // remove the character ":" return $ mac_addr;} // Obtain the CPU serial number function getCpuSN () {$ return_arry = array (); @ exec ("wmic cpu get processorid", $ return_arry); $ cpu_sn = $ return_arry [1]; return $ cpu_sn;} // Obtain the motherboard serial number function getBaseboardSN () {$ return_arry = array (); @ exec ("wmic baseboard get serialnumber", $ return_arry); $ baseboard_sn = $ return_arry [1]; $ baseboard_sn = str_replace ("-", "", $ baseboard_sn); // remove the character "-" return $ baseboard_sn;} from the string. example:
Include'Hardwareinfo. php '; $ hw_addr = new HardwareInfo (); $ mac_addr = $ hw_addr-> getMacAddress (); $ cpu_sn = $ hw_addr-> getCpuSN (); $ baseboard_sn = $ hw_addr-> getBaseboardSN (); echo 'Mac address :'. $ mac_addr.'
'; Echo 'CPU Serial Number:'. $ cpu_sn .'
'; Echo' motherboard address: '. $ baseboard_sn .'
'; Supplement: The use of wmic commands can be referred to: http://blog.csdn.net/hnllc2012/article/details/48733383
The above describes how to obtain the MAC address, cpu serial number, and motherboard serial number through the windows system command wmic in PHP, including some content, and hope to help those who are interested in the PHP Tutorial.