多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 一、找回密码之验证用户 ### 1.调试接口 +++ post:http://www.dakaifa.net/index.php?g=App&m=Reg&a=judge *string:name=13834626385#手机号 <<< success { "msg": 1 } <<< error { "msg": 0 } +++ ### 2.接口代码 ``` public function judge(){ $name = json_decode($_POST['name']); $map['mobile'] = $name; $users = M("Users"); $model = $users->where($map)->find(); if ($model) { # code... $ret = array('msg'=>1); echo json_encode($ret); }else{ $ret = array('msg'=>0); echo json_encode($ret); } } ``` ## 二、找回密码之修改密码 ### 1.调试接口 +++ post:http://www.dakaifa.net/index.php?g=App&m=Reg&a=update *string:name=13834626385#手机号 *string:password=123#密码 <<< success { "msg": 1 } <<< error { "msg": 0 } +++ ### 2.接口代码 ``` public function retrievepwd(){ $name = json_decode($_POST['name']); $password = json_decode($_POST['password']); $users = M("Users"); $map['mobile'] = $name; $data['mobile'] = $name; $data['user_pass'] = sp_password($password); $model = $users->where($map)->save($data); if ($model) { $ret = array('msg'=>1); echo json_encode($ret); }else{ $ret = array('msg'=>0); echo json_encode($ret); } } ```