<?php $res=system("ipconfig -all"); $contents=trim(ob_get_clean()); $contents=str_replace(" ","",$contents); $contents=explode(" ",$contents); foreach($contents as $k=>&$v) { $pre=substr($v,0,8); if($pre=="物理地址") { $ip=substr($v,36); break; } } var_dump($ip); ?>