PHP头条
热点:

初学PHP,编写了一个显示天气预报的程序,还望不要见笑。


刚开始学PHP,先编写了一个程序,放在自己的主页上,可以显示天气预报,当然还很不完善,希望大家给提意见。程序如下:
$fcont=file("http://www.bjmb.gov.cn/today.asp");
$arr=array();
for($i=0;$i $tmp=$fcont[$i];
$tmp=ereg_replace("
"," ",$tmp);
if(!strstr(strtolower($tmp),"img")){
$tmp=trim(strip_tags($tmp));
} else {
$st=ereg_replace("><",">⌒<",$tmp);
$stt=split("⌒",$st);
foreach($stt as $key => $value){
if(strstr($value,"img") ){
$tmp=$value;
$tmp=ereg_replace("src=","width=30 height=30 align=absmiddle src=",$tmp);
if(strstr($tmp,"bt9.jpg") || strstr($tmp,"colline.gif")) $tmp="";
}
}
}
if(trim($tmp)!="" && trim($tmp)!=" ") $arr[]=$tmp;
}
$yb=array();
for($i=2;$i $yb[]=$arr[$i];
}
?>


相关文章

相关频道:

PHP之友评论

今天推荐