跪求php5.3版本获取不到电脑的信息
程序员文章站
2022-06-16 14:57:38
...
//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版本都能行 小弟在这里跪求大侠些帮忙啊
//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版本都能行 小弟在这里跪求大侠些帮忙啊
回复讨论(解决方案)
php5.3 起,COM 扩展不再是默认加载的了
php.ini
extension=php_com_dotnet.dll
版主啊 就是这个 不知道那里下载啊 找了不安踏了
不需要下载,ext 目录中就有
取这个东西有什么作用嘛?程序绑定计算机?
嗯是这样的啊