文章前言
目前短网址就只有几个好用的平台
t.cn加了网址白名单 只允许政府和企业单位使用
url.cn则是没了解原理 所以没做
这就离谱:mask:
官方文档
https://developers.weixin.qq.com/doc/offiaccount/Account_Management/URL_Shortener.html
脚本环境
nginx/apache
php5/php7
所需材料
1.appid
2.appsecret
appid和appsecret可以申请一个微信公众号测试账号进行开发
申请地址:http://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login
请求流程
请求流程
1、获取本地缓存的access_token,如果超过有效期,则重新获取,如果还没过期,直接使用缓存的access_token
2、构建请求参数,发起POST请求
3、获得短网址
源码下载
https://www.lanzoux.com/iRa4Eh2i4ri
演示地址
https://www.toubiec.cn/wcurl.html
111111111111
哇,学习到了
文章写的不错,加油~