### [微信小程序中安全性问题如何处理](https://www.prosaas.cn/article/17490) **Published:** 2018-06-05T06:05:37 **Author:** 5201314 **Excerpt:** 这次给大家带来微信小程序中安全性问题如何处理,微信小程序中安全性问题的注意事项有哪些,下面就是实战案例,一起来… 这次给大家带来微信小程序中安全性问题如何处理,微信小程序中安全性问题的注意事项有哪些,下面就是实战案例,一起来看一下。 以下是关于配置信息的代码,仅供参考! //app.js var host = "" App({ onLaunch: function () { // 展示本地存储能力 var logs = wx.getStorageSync('logs') || \[\] logs.unshift(Date.now()) wx.setStorageSync('logs', logs) // var url = app.globalData.index // 登录 wx.login({ success: res => { // console.log(res); // 发送 res.code 到后台换取 openId, sessionKey, unionId wx.request({ url: this.globalData.session, data:{ code:res.code, }, success:res=>{ // console.log(res.header\['Set-Cookie'\]); wx.setStorage({ key: 'session\_id', data: res.header\['Set-Cookie'\], }) } }) } }) // 获取用户信息 // wx.getSetting({ // success: res => { // if (res.authSetting\['scope.userInfo'\]) { // // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 // wx.getUserInfo({ // success: res => { // // 可以将 res 发送给后台解码出 unionId // this.globalData.userInfo = res.userInfo // // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 // // 所以此处加入 callback 以防止这种情况 // if (this.userInfoReadyCallback) { // this.userInfoReadyCallback(res) // } // } // }) // } // } // }) }, globalData: { userInfo: null, index:\`${host}/home/index/index\`, add: \`${host}/home/index/add\`, session: \`${host}/home/index/session\`, upload: \`${host}/home/index/upload\`, getstu: \`${host}/home/index/getstu\`, login: \`${host}/home/index/login\` } }) 相信看了本文案例你已经掌握了方法,更多精彩请关注知企PROSAAS其它相关文章! 推荐阅读: 微信小程序开发中怎样实现微信支付 微信小程序开发中怎样实现图片上传 以上就是微信小程序中安全性问题如何处理的详细内容,更多请关注知企PROSAAS其它相关文章! **Categories:** 后端开发 ---