PHP is a beginner who has compiled a program for displaying weather forecasts.
Source: Internet
Author: User
When I first started learning PHP, I first compiled a program and placed it on my home page to display the weather forecast. of course, it is still not perfect. I hope you can give me some comments. The program is as follows :? $ Fcontfile (http://www.bjmb.gov.cn/today.asp); $ arrarray (); for ($ i0; $ icount ($ fcont); $ I ++) {$ tmp $ fcont [$ I]; when I first started learning PHP, I first compiled a program and placed it on my home page to display the weather forecast. of course, it is still not perfect. I hope you can give me some comments. The procedure is as follows:
$ 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 ("> <", "> Replace <", $ tmp );
$ Stt = split ("Shard", $ 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];
}
?>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service