<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<script type="text/jscript" href="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<style>
body{width:100%; min-height:100%;}
body img{width:100%;}
</style>
<title>关注分享送红包</title>
</head>
<body>
<p id="test">ttttttttttt</p>
<script>
wx.config({
debug: true,
appId: '<?php echo $signPackage["appId"];?>',
timestamp: <?php echo $signPackage["timestamp"];?>,
nonceStr: '<?php echo $signPackage["nonceStr"];?>',
signature: '<?php echo $signPackage["signature"];?>',
jsApiList: [
// 所有要调用的 API 都要加到这个列表中
'checkJsApi',
'openLocation',
'getLocation',
'onMenuShareTimeline',
'onMenuShareAppMessage'
]
});
wx.ready(function(){
alert('成功');
})
wx.error(function(res){
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的 debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
$('#test').html(res);
});
$('#test').html("bbbbbbbb");
</script>