企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
## 注册2 ### 1.接口地址 +++ post:http://www.dakaifa.net/index.php?g=App&m=Reg&a=update *int:uid=143#用户id *region=山西#所在区域 *address=太原#详细地址 *nicename=张天#名称 *sex=0#性别 *birthday=1989-09-10#生日 *stature=178#身高 *weight=60#体重 <<< success { "id": "143", "user_login": "", "user_pass": "###49c0a449a8d5ba5eb567c02f20f1a211", "user_nicename": "张天", "user_email": "", "user_url": "", "avatar": null, "sex": "1", "birthday": "1989-09-10", "signature": null, "last_login_ip": "", "last_login_time": "2016-08-09 11:50:13", "create_time": "2016-08-09 11:50:13", "user_activation_key": "", "user_status": "1", "score": "0", "user_type": "2", "coin": "0", "mobile": "13934529163", "address": "太原", "region": "山西", "stature": "1", "weight": "", "user_token": "ik5XzZkb2ToPTBG+J8EnzCIIWMoykUCbj0oNzvEKkLz0stjVxlXkTGkwBKSNwWvP/hZA+SxubqmgDZAIO4+E2A==", "ap_avatar": null, "identity": null } Method POST Request Headers [ <<< error +++ ### 2. 接口代码 ``` public function update(){ $users_model=M("Users"); $uid=$_POST['uid']; $data['region']=$_POST['region']; $data['address']=$_POST['address']; $data['user_nicename']=$_POST['nicename']; $sex=$_POST['sex']; if($sex=='男'){ $data['sex']=0; }else{ $data['sex']=1; } $stature=substr($_POST['stature'],0,-2); $data['stature']=$stature; $data['birthday']=$_POST['birthday']; $weight=substr($_POST['weight'],0,-2); $data['weight']=$weight; $ServerAPI = new \ServerAPI('kj7swf8o7owm2','sqrSkivNd3AWNc');//实例化,注意加\ $name = $data['user_nicename']; $portraitUri = "http://www.dakaifa.net/public/images/headicon.png"; $token = $ServerAPI->getToken($uid, $name, $portraitUri); $user_token = json_decode($token); $object = json_decode( json_encode( $user_token),true); $tk = $object['token']; $data ['user_token'] = $tk; $model = $users_model->where("id={$uid}")->save($data); $arr = $users_model->where("id={$uid}")->find(); if ($model) { echo json_encode($arr); } } ```