ImageVerifierCode 换一换
格式:DOCX , 页数:19 ,大小:20.89KB ,
资源ID:6265143      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6265143.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(PHP天气API接口.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

PHP天气API接口.docx

1、PHP天气API接口PHP天气API接口中国天气网的API还每次还要先去判断ID,再获取天气信息,觉得有点麻烦,所以自己做了一个PHP一部搞定的。还有一个农历API。code=1) return false; $data = $ip-data-city; return $data; function getWeather($cityId) $url= $weather=file_get_contents($url); return $weather; function $web) $arr=array(); foreach($web as $k=$w) if(is_object($w) $ar

2、r$k=$w); /判断类型是不是object else $arr$k=$w; return $arr;$city = getCity(getIP();$city = str_split($city,strlen($city)-3);$city =$city0;$cityUrl = $web=file_get_contents($cityUrl);$arr=$web);$weatherInfo = getWeather($arr$city);echo(weather();echo($weatherInfo);echo();?城市源码无标题文档 var weatherInfo;var lunar

3、;var date = new Date();var g=晴:0 0px,多云:0 -40px,暴雪:0 -480px,大雪-暴雪:0 -480px,暴雨:0 -360px,大雨-暴雨:0 -360px,暴雨-大暴雨:0 -360px,大暴雨-特大暴雨:0 -360px,大暴雪:0 -480px,飑:0 -880px,大雪:0 -440px,中雪-大雪:0 -440px,大雨:0 -320px,中雨-大雨:0 -320px,浮层:0 -920px,雷阵雨:0 -160px,雷阵雨并伴有冰雹:0 -200px,霾:0 -920px,轻雾:0 -840px,雾:0 -840px,冰雹:0 -680

4、px,沙尘暴:0 -760px,强沙尘暴:0 -760px,特大暴雪:0 -520px,小雪:0 -600px,小雨:0 -240px,扬沙:0 -720px,浮尘:0 -920px,龙卷风:0 -800px,弱高吹雪:0 -600px,阴:0 -80px,雨夹雪:0 -400px,冻雨:0 -960px,阵雪:0 -560px,阵雨:0 -120px,中雪:0 -640px,小雪-中雪:0 -640px,小雨-中雨:0 -280px,中雨:0 -280px;$(document).ready(function() $(#weekday).html(date.getDate(); $.getS

5、cript(getWeather.php); $.getScript(lunar.php););var weather = function(data) weatherInfo = data; $(.cityWrap .name).html(data.weatherinfo.city); $(.cityInfo .name).html(data.weatherinfo.weather1); $(.cityWrap .info).html(data.weatherinfo.city_en); $(.cityInfo .info).html(data.weatherinfo.st1+); $(.w

6、eapic).css(background-position,gdata.weatherinfo.weather1).show();var lunar = function(data) lunar = data; var month = data.month; var day = data.day; $(#lunarday).html(农历+month+day); $(#dateday).html(date.getFullYear()+.+(date.getMonth()+1)+.+date.getDate()+ +getWeek(date.getDay();var getWeek

7、= function(day) switch(day) case 0: return 周一; case 1: return 周二; case 2: return 周三; case 3: return 周四; case 4: return 周五; case 5: return 周六; case 6: return 周日; charset utf-8;* padding: 0; margin: 0; border: none; text-decoration: none; list-style: none; overflow: hidden;input, button, select, texta

8、rea outline: none;textarea font-size: 13px; resize: none;body background: #F2F2F2 url( top center no-repeat;.top width: 100%; height: 65px;.top_content width: 960px; height: 65px; margin: 0 auto;#calendarArea width: 155px; height: 65px; float: left; cursor: pointer; padding-left: 15px;#calendarArea:

9、hover, #topWeatherArea:hover background: url( top right;.datepic background-image: url( background-repeat: no-repeat; width: 31px; height: 32px; float: left; text-align: center; font-size: 16px; font-weight: bold; line-height: 32px; display: block; margin: 15px 10px 0 0; float: left;#weekday positio

10、n: relative; top: 4px; color: #fff;#calendarArea ul float: left; color: #fff; height: 40px; padding-top: 13px; padding-left: 3px;#calendarArea #lunarday font-size: 16px; font-weight: bold;#calendarArea #dateday font-size: 14px;#topWeatherArea width: 165px; height: 65px; float: left; cursor: pointer;

11、 color: #fff; padding-left:10px;.cityWrap float: left; margin-top: 15px; padding-left:5px;.weapic width: 40px; height: 40px; background-image: url( float: left; display: block; margin: 15px 5px 0 5px; background-repeat: no-repeat; display:none;.cityInfo float: left; margin-top: 15px;.name font-weigh

12、t: bold; font-size:17px;.info font-size:14px;?phpclass Lunar public $MIN_YEAR = 1891; public $MAX_YEAR = 2100; public $lunarInfo = array(array(0,2,9,21936),array(6,1,30,9656),array(0,2,17,9584),array(0,2,6,21168),array(5,1,26,43344),array(0,2,13,59728),array(0,2,2,27296),array(3,1,22,44368),array(0,

13、2,10,43856),array(8,1,30,19304),array(0,2,19,19168),array(0,2,8,42352),array(5,1,29,21096),array(0,2,16,53856),array(0,2,4,55632),array(4,1,25,27304),array(0,2,13,22176),array(0,2,2,39632),array(2,1,22,19176),array(0,2,10,19168),array(6,1,30,42200),array(0,2,18,42192),array(0,2,6,53840),array(5,1,26

14、,54568),array(0,2,14,46400),array(0,2,3,54944),array(2,1,23,38608),array(0,2,11,38320),array(7,2,1,18872),array(0,2,20,18800),array(0,2,8,42160),array(5,1,28,45656),array(0,2,16,27216),array(0,2,5,27968),array(4,1,24,44456),array(0,2,13,11104),array(0,2,2,38256),array(2,1,23,18808),array(0,2,10,1880

15、0),array(6,1,30,25776),array(0,2,17,54432),array(0,2,6,59984),array(5,1,26,27976),array(0,2,14,23248),array(0,2,4,11104),array(3,1,24,37744),array(0,2,11,37600),array(7,1,31,51560),array(0,2,19,51536),array(0,2,8,54432),array(6,1,27,55888),array(0,2,15,46416),array(0,2,5,22176),array(4,1,25,43736),a

16、rray(0,2,13,9680),array(0,2,2,37584),array(2,1,22,51544),array(0,2,10,43344),array(7,1,29,46248),array(0,2,17,27808),array(0,2,6,46416),array(5,1,27,21928),array(0,2,14,19872),array(0,2,3,42416),array(3,1,24,21176),array(0,2,12,21168),array(8,1,31,43344),array(0,2,18,59728),array(0,2,8,27296),array(

17、6,1,28,44368),array(0,2,15,43856),array(0,2,5,19296),array(4,1,25,42352),array(0,2,13,42352),array(0,2,2,21088),array(3,1,21,59696),array(0,2,9,55632),array(7,1,30,23208),array(0,2,17,22176),array(0,2,6,38608),array(5,1,27,19176),array(0,2,15,19152),array(0,2,3,42192),array(4,1,23,53864),array(0,2,1

18、1,53840),array(8,1,31,54568),array(0,2,18,46400),array(0,2,7,46752),array(6,1,28,38608),array(0,2,16,38320),array(0,2,5,18864),array(4,1,25,42168),array(0,2,13,42160),array(10,2,2,45656),array(0,2,20,27216),array(0,2,9,27968),array(6,1,29,44448),array(0,2,17,43872),array(0,2,6,38256),array(5,1,27,18

19、808),array(0,2,15,18800),array(0,2,4,25776),array(3,1,23,27216),array(0,2,10,59984),array(8,1,31,27432),array(0,2,19,23232),array(0,2,7,43872),array(5,1,28,37736),array(0,2,16,37600),array(0,2,5,51552),array(4,1,24,54440),array(0,2,12,54432),array(0,2,1,55888),array(2,1,22,23208),array(0,2,9,22176),

20、array(7,1,29,43736),array(0,2,18,9680),array(0,2,7,37584),array(5,1,26,51544),array(0,2,14,43344),array(0,2,3,46240),array(4,1,23,46416),array(0,2,10,44368),array(9,1,31,21928),array(0,2,19,19360),array(0,2,8,42416),array(6,1,28,21176),array(0,2,16,21168),array(0,2,5,43312),array(4,1,25,29864),array

21、(0,2,12,27296),array(0,2,1,44368),array(2,1,22,19880),array(0,2,10,19296),array(6,1,29,42352),array(0,2,17,42208),array(0,2,6,53856),array(5,1,26,59696),array(0,2,13,54576),array(0,2,3,23200),array(3,1,23,27472),array(0,2,11,38608),array(11,1,31,19176),array(0,2,19,19152),array(0,2,8,42192),array(6,

22、1,28,53848),array(0,2,15,53840),array(0,2,4,54560),array(5,1,24,55968),array(0,2,12,46496),array(0,2,1,22224),array(2,1,22,19160),array(0,2,10,18864),array(7,1,30,42168),array(0,2,17,42160),array(0,2,6,43600),array(5,1,26,46376),array(0,2,14,27936),array(0,2,2,44448),array(3,1,23,21936),array(0,2,11,37744),array(8,2,1,18808),array(0,2,19,18800),array(0,2,8,25776),array(6,1,28,27216),array(0,2,15,59984),array(0,2,4,27424),array(4,1,24,43872),array(0,2,12,43744),array(0,2,2,37600),array(3,1,21,51568),array(0,2,9,51552),array(7,1,29,54440),array(0,2,17,54432),array(0,2,5,55888)

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1