マシンのネットワーク カードの物理 (MAC) アドレスを取得します。

WBOY
リリース: 2016-07-25 09:09:52
オリジナル
908 人が閲覧しました
    /**
  1. マシンのネットワーク カードの物理 (MAC) アドレスを取得します
  2. **/
  3. class GetMacAddr
  4. {
  5. var $return_array = array(); // MAC アドレスを含む文字列配列を返します
  6. var $mac_addr
  7. function GetMacAddr( $os_type)
  8. {
  9. switch (strto lower($os_type) )
  10. {
  11. case "linux ":
  12. $this->forLinux();
  13. case "solaris ":
  14. take;
  15. ブレーク;
  16. ケース ":
  17. ブレーク;
  18. $this-> forWindows();
  19. $temp_array =
  20. foreach ( $this-> return_array value )
  21. {
  22. if ( preg_match( "/[0-9a-f][0-9a-f][:-] "."[0-9a-f][0-9a-f][: -] ". "[0-9a-f][0-9a-f][:-] ". "[0-9a-f][0-9a-f][:-] "."[0- 9a- f][0-9a-f][:-] ". "[0-9a-f][0-9a-f]/i ", $value, $temp_array ) )
  23. {
  24. $this-> ; mac_addr = $temp_array[0];
  25. ブレーク;
  26. }
  27. }
  28. unset($temp_array);
  29. 関数 forWindows()
  30. @exec( "ipconfig /all ", $this-> return_array);
  31. if ( $this-> return_array )
  32. $ipconfig = $_SERVER "]
  33. if ( is_file($ipconfig) )
  34. @exec($ipconfig. " /all ", $this-> return_array);
  35. else
  36. @exec($_SERVER[ "WINDIR "]. "systemipconfig.exe /all " , $ this-> return_array);
  37. return $this-> return_array;
  38. }
  39. @exec( "ifconfig -a ", $this-> return_array); -> return_array;
  40. }
  41. $mac->
  42. ;
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!