七零部落格
思则大道至简,疑则谜团重重!
思则大道至简,疑则谜团重重!
<?php /** * 获取cpu序列号 */ function getCpuId(){ $uuid = ''; exec("wmic CPU get ProcessorID", $result); $uuid = $result[1]; return $uuid; } /** * 获取硬盘序列号(第一个硬盘) */ function getDiskId(){ $uuid = ''; $bat = dirname(__FILE__) . '/'. time() . rand(11111,99999) . rand(11111,99999) . '.bat'; file_put_contents($bat, "select disk 0 \n detail disk"); exec("diskpart /s " . realpath($bat) , $result); unlink($bat); foreach ($result as $key => $value) { if (strpos($value, 'ID:')!==false) { $uuid = trim(substr($value, (strpos($value, 'ID:') + 3))); } } return $uuid; } echo getCpuId(); echo '***'; echo getDiskId(); exit();