⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.php

📁 北京找巴士天气预报
💻 PHP
字号:
<?
//演示:http://www.bjzbus.cn/weather/
require_once 'city.php';
 $code=array_search($_GET["city"],$tcity);
if($code=='') $code="54511";
 function get_cma_weather($citycode){
    	if(!$htmlarr=file('http://www.cma.gov.cn/tqyb/weatherdetail/'.$citycode.'.html')){
		$htmlarr=file('http://www.cma.gov.cn/tqyb/weatherdetail/'.$citycode.'.html');
		}

    	
    	list($dateregine,$weather['city']) = explode("&nbsp;&nbsp;&nbsp;",strip_tags($htmlarr['861']));
    	$arr['date'] = array($htmlarr['871'],$htmlarr['872'],$htmlarr['873']);
    	$arr['weather'] = array($htmlarr['883'],$htmlarr['890'],$htmlarr['897']);
    	$arr['temperature'] = array($htmlarr['917'],$htmlarr['918'],$htmlarr['919']);
    	$winddirect = array($htmlarr['925'],$htmlarr['926'],$htmlarr['927']);
    	unset($htmlarr);
    	foreach($arr as $k => $v){
    		foreach($v as $key => $val){
    			$weather[$k][$key] = strip_tags($val);
    		}
    	}
    	foreach($winddirect as $k => $v){
    		$weather['winddirect'][$k] = htmlspecialchars(eregi_replace('(.+)*"b-cn">(.+)*</td>',"\\2",$v));
    	}
    	return $weather;
    }
	$wea=get_cma_weather($code);
//北京公交网(www.bjzbus.cn)
?>

<style type="text/css">
body,table{font-size:12px;line-height:150%;}
A.color4:link {COLOR: #DD7D02;TEXT-DECORATION: none}
A.color4:visited { COLOR: #DD7D02;TEXT-DECORATION: none} 
A.color4:active { COLOR: #DD7D02;TEXT-DECORATION: underline} 
A.color4:hover { COLOR: #DD7D02;TEXT-DECORATION: underline}
</style>
<table width="300" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td><img src="./images/r_t12.gif" width="300" height="35"></td></tr>
<tr align="center"><td height="60"><table width="300" border="0" cellspacing="0" cellpadding="0" background="./images/r_tembg22.gif">
<tr><td colspan="4"><img src="./images/r_tembg12.gif" width="300" height="6"></td></tr>
<tr>
<td colspan="4" height="23" align="left" background="./images/r_tembg62.gif">&nbsp;&nbsp;<? echo $wea['city']; ?>
</td>
</tr>
<tr><td height="1" align="center" colspan="4" background="./images/line22.gif"></td></tr>
<tr>
<td width="72" height="23" align="center"><img src="./images/tem3.gif" width="57" height="13"></td>
<td width="78" height="23" align="center">          <? echo $wea['date'][0]; ?>
</td>
<td width="78" height="23" align="center">          <? echo $wea['date'][1]; ?>
</td>
<td width="78" height="23" align="center">		  <? echo $wea['date'][2]; ?>
</td>
</tr>
<tr><td height="1" align="center" colspan="4" background="./images/line22.gif"></td></tr>
<tr>
<td width="72" height="23" align="center"><img src="./images/tq.gif" width="57" height="13"></td>
<td height="23" align="center">              <? echo $wea['weather'][0]; ?>
</td>
<td height="23" align="center">              <? echo $wea['weather'][1]; ?>
</td>
<td height="23" align="center">              <? echo $wea['weather'][2]; ?>
</td>
</tr>
<tr><td height="1" align="center" colspan="4" background="./images/line22.gif"></td></tr>
<tr>
<td width="72" height="23" align="center"><img src="./images/tem1.gif" width="57" height="13"></td>
<td height="23" align="center">          <? echo $wea['temperature'][0]; ?>
</td>
<td height="23" align="center">          <? echo $wea['temperature'][1]; ?>
</td>
<td height="23" align="center">          <? echo $wea['temperature'][2]; ?>
</td>
</tr>
<tr><td height="1" align="center" colspan="4" background="./images/line22.gif"></td></tr>
<tr>
<td width="72" height="23" align="center"><img src="./images/tem2.gif" width="57" height="13"></td>
<td height="23" align="center"><? echo $wea['winddirect'][0]; ?>
</td>
<td height="23" align="center"><? echo $wea['winddirect'][1]; ?>
</td>
<td height="23" align="center"><? echo $wea['winddirect'][2]; ?>
</td>
</tr>
<tr><td colspan="4"><img src="./images/r_tembg32.gif" width="300" height="3"></td></tr>
</table><!-- 北京公交网(www.bjzbus.cn) --></td></tr>
</table>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -