我想要客户端的Mac(系统物理地址)地址,但是当我在服务器中托管时,我没有得到任何东西。
我用于获取Mac地址的代码是:
ob_start();
system('ipconfig /all');
$mycomsys=ob_get_contents();
ob_clean();
$find_mac = "LAN Card";
$pmac = strpos($mycomsys, $find_mac);
$macaddress=substr($mycomsys,($pmac+49),17);
echo $macaddress;
我不知道在哪里出错。PLESAE帮助我解决此问题。
服务器上运行了哪个系统?如果不是Windows,则其他系统(Linux等)不了解/全部。如果是Windows,请当心服务器卡不必称为" LAN卡"。首先查看IFCONFIG的全部输出。
如果使用Windows Server。然后尝试此代码。
<?php
ob_start();
system('ipconfig /all');
$mycomsys=ob_get_contents();
ob_clean();
$find_mac = "Physical Address";
$pmac = strpos($mycomsys, $find_mac);
$macaddress=substr($mycomsys,($pmac+35),17);
echo $macaddress;