ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 一、找回密码之验证用户 ### 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); } } ```