<?php //例如查询ip地址:
$mip = file_get_contents("http://1212.ip138.com/ic.asp"); if($mip){ preg_match("/\[.*\]/",$mip,$sip); $p = array("/\[/","/\]/"); echo preg_replace($p,"",$sip[0]); }else{echo "获取本地IP失败!";} ?>