我正在尝试获取PHP中的BIOS序列号,该序列号将通过Exeoutput存储为exe。由于我无法在exeoutput中获取序列号,而是在浏览器中获取序列号,因此得出结论,php文件正在虚拟目录下运行,因此它们无法访问硬件。我也有建议我应该使用VBScript来获取BIOS序列号,并将其传递回php。我的vbscript如下:
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array(".")
For Each strComputer In arrComputers
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo objItem.IdentifyingNumber
Next
Next
调用php代码如下:
$WshShell = new COM("WScript.Shell");
$obj = $WshShell->Run("cscript mbs.vbs", 0, true);
var_dump($obj);
在命令提示符下执行vbs时,我正在获取序列号,但是当尝试使其通过php时,我只能得到
int(1) 打印在网页上。