只能在局域网内有效:mac.php<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<?php
function get_mac($ip = null) {
if (null == $ip) {
$ip = $_SERVER['REMOTE_ADDR'];
}
exec("nbtstat -A $ip",$arr);
$macLine = $arr[count($arr)-2];
$mac = substr($macLine, -17);
return $mac;
}echo get_mac();?>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head><body>
<?php
function get_mac($ip = null) {
if (null == $ip) {
$ip = $_SERVER['REMOTE_ADDR'];
}
exec("nbtstat -A $ip",$arr);
$macLine = $arr[count($arr)-2];
$mac = substr($macLine, -17);
return $mac;
}echo get_mac();?>
</body>
</html>
你的这个代码有点问题
Warning: exec(): Unable to fork [/nbtstat -A 61.139.105.108] in D:\www\mast.php on line 13
还有你这样也使测得服务器的Mac吧
我想要的是 客户端的Mac