Home > Article > Backend Development > 跪求php5.3版本获取不到计算机的信息
跪求php5.3版本获取不到电脑的信息
//phpinfo();
//exit;
/** 取硬盘序列号 */
function getDiskSID(){
$sid = array();
$wmd = new COM("Winmgmts://./root/cimv2");
$wqd = $wmd->ExecQuery("Select * From Win32_DiskDrive");
foreach($wqd as $row){
$sid[] = $row->PNPDeviceID;
}
return $sid;
}
/** 取CPU序列号 */
function getCpuSID(){
$sid = array();
$objLocator = new COM("WbemScripting.SWbemLocator");
$wmi = $objLocator->ConnectServer();
//$info=$wmi->Get("Win32_PnPEntity");
$info = $wmi->Get("Win32_Processor");
$arrProp = $info->Properties_();
$arrWEBMCol = $info->Instances_();
foreach($arrWEBMCol as $objItem) {
$sid[] = $objItem->ProcessorId;
}
return $sid;
}
/** 取主板序列号 */
function getBoardSID(){
$sid = array();
$objLocator = new COM("WbemScripting.SWbemLocator");
$wmi = $objLocator->ConnectServer();
$info = $wmi->Get("Win32_BaseBoard");
$arrWEBMCol = $info->Instances_();
foreach($arrWEBMCol as $row){
$sid[] = $row->SerialNumber ;
}
return $sid;
}
var_dump(@getBoardSID());
var_dump(@getDiskSID());
var_dump(@getCpuSID());
5.2版本都能行 小弟在这里跪求大侠些帮忙啊