不知道什么时候突然发现一个给女友的推送早安程序出现在了人们的视线中,一阵热潮吧,来的快去的也快,当我看到图片中微信推送的内容是什么关于天气、温度等等的内容我就知道了,又是一个面向api编程的程序。
进入正题。。。
我制作的这个推送程序部署方法
Windows:
php+Apache/Nginx(新手就建议直接使用PHPstudy)
Windows版phpstudy下载 – 小皮面板(phpstudy) (xp.cn)
傻瓜式环境安装
Linux:
php+Apache/Nginx(建议使用宝塔安装环境)
使用说明:

以上内容为wxpush程序的完整内容
将wxpush文件移动值站点根目录,
这里建议使用宝塔进行以下操作

将wxpush/public设置为网站的根目录
打开wxpush\application\index\controller路径下的index.php修改项目配置信息
注意:所有” ”处都需要填写相应配置,除特殊说明的地方
1.

打开链接微信公众平台 (qq.com)
登录后。。。

可以看到对应内容
2.


3.

city就填写你需要获取天气的城市名称即可
天气api秘钥、农历api秘钥等需要去https://api.muxiaoguo.cn/注册登录后获取api秘钥
ps:此api以无法正常使用了

购买之后可以在我的接口中查看秘钥

api_key后面的就是秘钥,对应填好即可
如果上面的内容全部填写完毕,那么配置的内容就全部就结束了
项目运行方式
windows定时推送
需要安装支持EasyTask扩展环境参考文档:Windows安装 · EasyTask开发文档 · 看云 (kancloud.cn)

环境全部配置完毕之后

测试代码如果能运行成功,那么就可以直接运行定时推送代码了

如果需要修改推送时间,那么只需要修改这部分代码
hour代表小时,24小时制
time代表分钟
s代表秒数
Linux运行

比windows容易许多,
如果还是感觉麻烦,可以使用宝塔的定时任务

使用定时任务前先尝试访问域名/index/index/send

如果访问后微信可以收到正常推送,那么就可以启动定时任务啦!
是否能正常运行