1.首先你要有一个可以就行人脸识别的服务器,然后就是上传到百度云,百度云人脸识别的API接口全面升级到V3版本,并进行开放测试

2.wxml代码
camera device-position="{{sxt}}" flash="off" binderror="error" style="width: 100%; height: 300px;"/camera view class="weui-cells weui-cells_after-title" view class="weui-cell weui-cell_switch" view class="weui-cell__bd"/view input name='sex' value='{{sxt}}'{{sxt}}/input switch checked bindchange='switch1Change'/ /view /view button type="primary" bindtap="takePhoto"拍照/button 3.js代码
data: { sxt: '前置' }, switch1Change: function (e) { console.log(e) var front = '前置' var back = '后置' if (this.data.sxt == '前置') { this.setData({ sxt: back }) } else if (this.data.sxt == '后置') { this.setData({ sxt: front }) } }, takePhoto() { const ctx = wx.createCameraContext() ctx.takePhoto({ quality: 'high', success: (res) = { this.setData({ src: res.tempImagePath }) wx.showLoading({ title:'正在核验身份...', }) this.setData({logindisabled:true}); wx.uploadFile({ url: 'http://www.swinder.top/server/index.php/home/index/login', 微信小程序阿里人脸识别http://www.xiaochengxub.com/read-105893.html