exec('/sbin/arp -a 2>&1', $array, $return_val);
dump($array);
$mac = '';
foreach($array as $value){
//匹配结果放到数组$mac_array
if(strpos($value,$_SERVER["REMOTE_ADDR"]) && preg_match("/(:?[0-9A-F]{2}[:-]){5}[0-9A-F]{2}/i",$value,$mac_array)){
$mac = $mac_array[0];
break;
}
}
echo $mac;