参考链接:http://blog.bwphp.cn/?p=617 <?php $appid = "wx69ee1b32fb7e9121"; $secret = "b5606c679038148d6e858687bc830a18"; $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$secret; $res = file_get_contents($url); $data = json_decode($res); var_dump($data->access_token); $jsapi_ticket_json = file_get_contents('https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token='.$data->access_token.'&type=jsapi'); $jsapi_ticket_obj = json_decode($jsapi_ticket_json); $jsapi_ticket = $jsapi_ticket_obj->ticket; $noncestr = 'qwertyuiop'; $timestamp = time(); $signature = sha1(sprintf('jsapi_ticket='.$jsapi_ticket.'&noncestr='.$noncestr.'×tamp='.$timestamp.'&url=http://zhangsixia.bwphp.cn/wei1.php')); echo $signature; ?> <script src='http://res.wx.qq.com/open/js/jweixin-1.0.0.js'></script> <script type="text/javascript"> wx.config({ debug: true, appId: '<?php echo $appid; ?>', timestamp: <?php echo $timestamp; ?>, nonceStr: '<?php echo $noncestr; ?>', signature: '<?php echo $signature; ?>', jsApiList: ['uploadImage','downloadImage'] }); wx.ready(function(){ wx.checkJsApi({ jsApiList: ['chooseImage'], success: function(res) {} }); wx.chooseImage({ success: function (res) { var localIds = res.localIds; } }); }); wx.error(function(res){ alert('no'); }); </script>
当前题目:微信JS-SDK加载验证流程
当前URL:https://www.cdcxhl.com/article12/gijpdc.html
成都网站建设公司_创新互联,为您提供App设计、网站排名、网站改版、网站策划、网页设计公司、网站设计公司
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联