window系统上用PHP获取本地物理IP代码
<?php $res=system("ipconfig -all"); $contents=trim(ob_get_clean()); $contents=str_replace("\r\n","",$contents); $contents=explode(" ",$contents); foreach($contents as $k=>&$v) { $pre=substr($v,0,8); if($pre=="物理地址") { $ip=substr($v,36); break; } } var_dump($ip); ?>