File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Umbrella
22一个PHP的小程序,可以设置定时发送邮件提醒带伞
33
4- 当前版本:Ver.3,已实现的功能有:多用户,可选雨天单独推送
4+ 当前版本:Ver.3,已实现的功能有:多用户,可以控制的推送时间选择, 可选雨天单独推送
55
66在 https://console.heweather.com/ 申请好KEY后
77
@@ -47,7 +47,8 @@ $smtppass = "yourpassword"; //SMTP服务器的用户密码
4747您可以部署于WEB服务器或
4848` php /home/umb/umbrellaV3.php `
4949直接运行
50- 亦可设置crontab做定时任务
50+
51+ 亦可设置crontab做定时任务,自V3.1.0后,建议设置为每小时一次的定时任务或自动访问url。
5152
5253~~ 喜欢请star,虽然我知道我只是写了一坨shit~~
5354
Original file line number Diff line number Diff line change @@ -18,12 +18,14 @@ foreach ($userarr['users'] as $userkey => $userval) { //遍历用户json生成
1818 $ usermail = ($ userval ['usermail ' ]);
1919 $ userid = ($ userval ['userid ' ]);
2020 $ usersunflag = ($ userval ['usersunflag ' ]);
21- echo ($ usersunflag );
21+ $ usertime = ($ userval ['usertime ' ]);
22+ $ usertemp = ($ userval ['usertemp ' ]);
2223 $ jsonadd = "https://free-api.heweather.com/s6/weather/forecast?location= {$ location }&key= {$ Hekey }" ; //json地址
2324 $ weatherjson = file_get_contents ($ jsonadd );
2425 $ weatherarr = json_decode ($ weatherjson , TRUE );
2526 $ usercity = ($ weatherarr ['HeWeather6 ' ]['0 ' ]['basic ' ]['location ' ]);
2627 $ weathertime = ($ weatherarr ['HeWeather6 ' ]['0 ' ]['update ' ]['loc ' ]);
28+ if ($ usertime == date ('H ' )){
2729 foreach ($ weatherarr ['HeWeather6 ' ][0 ]['daily_forecast ' ] as $ weatherkey => $ weatherval ) { //确定城市后循环遍历天气数据
2830 $ data [] = "日期: " . $ weatherval ['date ' ];
2931 $ txt_d [] = "{$ weatherval ['cond_txt_d ' ]}" ;
@@ -216,7 +218,8 @@ LABELSS;
216218 $ txt_n = "" ;
217219 $ winds = "" ;
218220 $ tmps = "" ;
219- //print_r($mailstr);//web预览邮件样式
221+ print_r ($ mailstr );//web预览邮件样式
222+ }
220223}
221224?>
222225
Original file line number Diff line number Diff line change 22 "users" :[
33 {
44 "location" : " shanghai" ,
5- "usermail" : " 584121960 @qq.com" ,
5+ "usermail" : " example @qq.com" ,
66 "usersunflag" : " true" ,
7- "userid" : " Nchyn"
7+ "userid" : " Nchyn" ,
8+ "usertemp" : " true" ,
9+ "usertime" : " 17"
810 },
911 {
1012 "location" : " taiyuan" ,
11- "usermail" : " mail@nchyn .com" ,
13+ "usermail" : " example@163 .com" ,
1214 "usersunflag" : " false" ,
13- "userid" : " Nchyn2"
15+ "userid" : " Nchyn2" ,
16+ "usertemp" : " false" ,
17+ "usertime" : " 16"
1418 }
1519 ]
1620}
You can’t perform that action at this time.
0 commit comments