php 获取Mac地址

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 获取Mac地址相关的知识,希望对你有一定的参考价值。

// Turn on output buffering
ob_start();
// Get the ipconfig details using system commond
system('ipconfig /all');

// Capture the output into a variable
$mycom = ob_get_contents();
// Clean (erase) the output buffer
ob_clean();

$findme = "Physical";
// Search the “Physical” | Find the position of Physical text
$pmac = strpos($mycom, $findme);

// Get Physical Address
$mac = substr($mycom,($pmac+36),17);
$mac = str_replace('-', ':', strtolower($mac));

以上是关于php 获取Mac地址的主要内容,如果未能解决你的问题,请参考以下文章

php开发中怎么获取服务端MAC地址?

如何在 PHP 中获取已连接客户端的 MAC 和 IP 地址?

如何使用 PHP 获取客户端的 MAC 地址?

php 获取Mac地址

php获取客户端mac地址

php/js获取客户端mac地址的实现代码