onanying / Wechat Jssdk Signature
微信JSSDK服务端生成签名认证,包含后端PHP与前端JS的实现,PHP后端有缓存access_token、jsapi_ticket。
Stars: ✭ 19
Projects that are alternatives of or similar to Wechat Jssdk Signature
Fw Cloud Framework
基于springcloud全家桶开发分布式框架(支持oauth2认证授权、SSO登录、统一下单、微信公众号服务、Shardingdbc分库分表、常见服务监控、链路监控、异步日志、redis缓存等功能),实现基于Vue全家桶等前后端分离项目工程
Stars: ✭ 717 (+3673.68%)
Mutual labels: wechat
Cleanmywechat
自动删除 PC 端微信缓存数据,包括从所有聊天中自动下载的大量文件、视频、图片等数据内容,解放你的空间。
Stars: ✭ 816 (+4194.74%)
Mutual labels: wechat
Juejin
💰 Unofficial JueJin wechat mini program application - 掘金非官方微信小程序
Stars: ✭ 771 (+3957.89%)
Mutual labels: wechat
Lcactionsheet
一款简约而不失强大的 ActionSheet,微博、微信和 QQ 都采用了极其类似的样式,完全支持 Swift。
Stars: ✭ 809 (+4157.89%)
Mutual labels: wechat
Smartim4intellij
IntelliJ IDEA上的SmartIM(原SmartQQ)插件,可以在IDEA中使用QQ或微信聊天
Stars: ✭ 822 (+4226.32%)
Mutual labels: wechat
Weui
A UI library by WeChat official design team, includes the most useful widgets/modules in mobile web applications.
Stars: ✭ 26,030 (+136900%)
Mutual labels: wechat
Online Markdown
A online markdown converter specially for Wechat Public formatting.
Stars: ✭ 812 (+4173.68%)
Mutual labels: wechat
Flirtdb
A community driven collection of IDA FLIRT signature files
Stars: ✭ 809 (+4157.89%)
Mutual labels: signature
Wechat Alfred Workflow
wechat workflow for Alfred:微信快速发送消息 & 打开聊天窗口 & 查看聊天记录 & more…
Stars: ✭ 822 (+4226.32%)
Mutual labels: wechat
Python Weixin
微信(weixin|wechat) Python SDK 支持开放平台和公众平台 支持微信小程序云开发
Stars: ✭ 746 (+3826.32%)
Mutual labels: wechat
Multisignaturewallet
311 byte EIP712 Signing Compliant Delegate-Call Enabled MultiSignature Wallet for the Ethereum Virtual Machine
Stars: ✭ 16 (-15.79%)
Mutual labels: signature
Go jwt
golang for websocket wechat or weixin and jwt,http ratelimit
Stars: ✭ 19 (+0%)
Mutual labels: wechat
wechat-jssdk-signature
微信JSSDK服务端生成签名认证,包含后端PHP与前端JS的实现,后端缓存access_token、jsapi_ticket。
怎么安装
在你的项目建立一个公开目录,把上面的代码全部放进去,例如:
http://www.****.com/wxjssdk/
配置开发者ID
打开 config.php 修改 CONF_APP_ID 与 CONF_APP_SECRET,不知道填什么?去你的公众平台去找吧!
// 微信开发者ID
define('CONF_APP_ID', '****************');
define('CONF_APP_SECRET', '********************************');
打开 jssdk-config.js 修改 appId、baseUrl、jsApiList
// 用户配置
var appId = '****************';
var baseUrl = 'http://www.****.com/wxjssdk/'; // jssdk_signature.php所在目录的URL
var jsApiList = ['getLocation', 'chooseWXPay', 'openLocation']; // 微信JS接口列表
使用范例
打开 jssdk_example.html 里面有一个定位的范例
范例讲解
范例里有引用3个js文件:
- 第一个是jquery,如果你的项目有引用,可以去掉
- 微信的jssdk的库,不能动
- 我写好的jssdk配置文件,这样你就不需要每个页面去配置了
<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript" src="/jssdk-config.js"></script>
接下来就是直接执行微信的js接口了,是不是很简单很方便
<script type="text/javascript">
// 配置成功后执行
wx.ready(function(){
// 获取地理位置
wx.getLocation({
type: 'wgs84',
success: function (res) {
console.log(res);
var latitude = res.latitude;
var longitude = res.longitude;
var speed = res.speed;
var accuracy = res.accuracy;
alert("latitude:" + latitude + " / latitude:" + longitude);
}
});
});
</script>
注意安全
因为 access_token、jsapi_ticket 做的是文件缓存,存放在 Cache 目录里,所以不要让别人知道你的url了,不然别人可以直接下载,我还是建议大家存到redis,memcache里去,修改下Core目录的Cache类就可以了,很简单的。
微信挖的坑
微信的签名算法要提供调用页面的url,文档是这样写的
看上面应该是支持带参数的page,但是和上面写的一样,竟然只支持一个get参数,也就是说下面这样的多个参数的page不支持,会报签名错误
要传多个值,就只能自己想办法咯,比如
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].