{"id":267,"title":"\u5fae\u4fe1\u5206\u4eab\u5230\u670b\u53cb\u5708\u53ca\u597d\u53cb","good":0,"bad":0,"hit":2094,"created_at":"2017-08-21 11:17:24","content":"

\u6700\u8fd1\u516c\u53f8\u5728\u641e\u4e00\u4e2a\u6d3b\u52a8\uff0c\u5fae\u4fe1\u626b\u4e00\u4e2a\u4ea7\u54c1\u7684\u4e8c\u7ef4\u7801(url),\u70b9\u70b9\u5206\u4eab\u5230\u670b\u53cb\u5708\u6216\u8005\u597d\u53cb\uff0c\u5206\u4eab\u6210\u529f\uff0c\u8bb0\u5f55\u5206\u4eab\u6b21\u6570\uff0c\u7136\u540e\u6839\u636e\u5206\u4eab\u6b21\u6570\u5224\u65ad\u662f\u5426\u6709\u6ca1\u6709\u8d44\u683c\u62bd\u5956\uff1a<\/p>

\u5982\u679c\u62a5signature\u9519\u8bef\uff0c\u8981\u53bb\u5fae\u4fe1\u91cc\u9762\u8bbe\u7f6ejs\u56de\u8c03\u5b89\u5168\u57df\u540d\uff0cip\u767d\u540d\u5355\uff0c\u4ee5\u53casdk\u4e2d\u83b7\u53d6\u7684url\u4e0e\u4e8c\u7ef4\u7801\u4e2d\u7684\u662f\u5426\u4e00\u81f4\uff08\u8fd9\u4e2a\u95ee\u9898\u641e\u4e86\u597d\u4e45\uff0c\u6211\u4eec\u7684\u670d\u52a1\u5668\u628a\u57df\u540d\u524d\u7f00\u81ea\u5df1\u7ed9\u66ff\u6362\u4e86server1\u53d8\u6210server4\u4e86\uff09<\/p>

<\/p>

\u4ee3\u7801\uff1a<\/p>

\u5f15\u5165\uff1ahttp:\/\/res.wx.qq.com\/open\/js\/jweixin-1.0.0.js<\/a> <\/p>

js\u90e8\u5206\uff1a<\/p>

wx.config({<\/p>

\t\t\tdebug: false,<\/p>

\t\t\tappId: '\u4f60\u7684appid',<\/p>

\t\t\ttimestamp: '\u7531php\u751f\u6210\u7684\u65f6\u95f4\u6233',<\/p>

\t\t\tnonceStr: 'php\u7528\u5fae\u4fe1sdk\u751f\u6210\u7684',<\/p>

\t\t\tsignature: 'php\u7528\u5fae\u4fe1sdk\u751f\u6210\u7684',<\/p>

\t\t\tjsApiList: [<\/p>

\t\t\t\t\/\/ \u6240\u6709\u8981\u8c03\u7528\u7684 API \u90fd\u8981\u52a0\u5230\u8fd9\u4e2a\u5217\u8868\u4e2d<\/p>

\t\t\t\t'onMenuShareTimeline',<\/p>

\t\t\t\t'onMenuShareAppMessage',<\/p>

\t\t\t]<\/p>

\t\t});<\/p>

<\/p>

<\/p>

\/\/\u5b8c\u6210wx.config\uff0c\u6267\u884c\u8fd9\u91cc<\/p>

\t\twx.ready(function () {<\/p>

\t\t\t\/\/\u5206\u4eab\u5230\u670b\u53cb\u5708<\/p>

\t\t\twx.onMenuShareTimeline({<\/p>

\t\t\t\ttitle: '\u8fd9\u91cc\u662f\u5206\u4eab\u7684\u6807\u9898', \/\/ \u5206\u4eab\u6807\u9898<\/p>

\t\t\t\tlink:window.location.href,<\/p>

\t\t\t\timgUrl: "\u8fd9\u91cc\u662f\u5206\u4eab\u56fe\u6807", \/\/ \u5206\u4eab\u56fe\u6807<\/p>

\t\t\t\tsuccess: function () {<\/p>

\t\t\t\t\t\/\/ \u5206\u4eab\u6210\u529f\u6267\u884c\u6b64\u56de\u8c03\u51fd\u6570<\/p>

\t\t\t\t\t\/\/alert('weiyulin_qixi_friends');<\/p>

                                        $.ajax({<\/p>

\t\t\t\t\t\ttype: "get",<\/p>

\t\t\t\t\t\turl: '\u5f02\u6b65\u8c03\u7528\u7684\u7f51\u5740\uff0c\u8bb0\u5f55\u5206\u4eab\u6b21\u6570'),<\/p>

\t\t\t\t\t\tdata: {},<\/p>

\t\t\t\t\t\tdataType: "json",<\/p>

\t\t\t\t\t\tsuccess:function(data){\t\t\t\t\t\t\t <\/p>

\t\t\t\t\t\t   \/\/alert(data);\t\t\t\t\t\t\t <\/p>

\t\t\t\t\t\t}<\/p>

<\/p>

\t\t\t\t\t});<\/p>

\t\t\t\t},<\/p>

\t\t\t\tcancel: function () {<\/p>

\t\t\t\t\t\/\/alert('cancel');<\/p>

\t\t\t\t}<\/p>

\t\t\t});<\/p>

\t\t\t\/\/\u5206\u4eab\u7ed9\u670b\u53cb<\/p>

\t\t\twx.onMenuShareAppMessage({<\/p>

\t\t\t\ttitle: '\u5206\u4eab\u6807\u9898', \/\/ \u5206\u4eab\u6807\u9898<\/p>

\t\t\t\tdesc: '\u63cf\u8ff0',<\/p>

\t\t\t\tlink:window.location.href,<\/p>

\t\t\t\timgUrl: "\u5206\u4eab\u56fe\u6807", \/\/ \u5206\u4eab\u56fe\u6807<\/p>

\t\t\t\tsuccess: function (res) {<\/p>

\t\t\t\t\t\/\/ \u5206\u4eab\u6210\u529f\u6267\u884c\u6b64\u56de\u8c03\u51fd\u6570<\/p>

                                $.ajax({<\/p>

                                                type: "get",<\/p>

                                                url: '\u5f02\u6b65\u8c03\u7528\u7684\u7f51\u5740\uff0c\u8bb0\u5f55\u5206\u4eab\u6b21\u6570'),<\/p>

                                                data: {},<\/p>

                                                dataType: "json",<\/p>

                                                success:function(data){                                                         <\/p>

                                                }<\/p>

                                        });                                                        <\/p>

<\/p>

\t\t\t\t},<\/p>

\t\t\t\tcancel: function (res) {<\/p>

\t\t\t\t\t\/\/alert('\u5df2\u53d6\u6d88');<\/p>

\t\t\t\t},<\/p>

\t\t\t\tfail: function (res) {<\/p>

\t\t\t\t\t\/\/alert(JSON.stringify(res));<\/p>

\t\t\t\t}<\/p>

\t\t\t});<\/p>

\t\t});<\/p>

<\/p>"}