## 注冊1
### 1.接口地址
+++
post:http://www.dakaifa.net/index.php?g=App&m=Reg&a=index
*int:mobile=13834626385#手機號
*int:password=123#密碼
<<<
{
"msg": 1,
"id": "144" //數據庫最后插入的id
}
<<<
error
{
"msg": "注冊失敗"
}
+++
### 2.接口代碼
```
public function index() {
$mobile=json_decode($_POST['mobile']);
$password=json_decode($_POST['password']);
$users_model=M("Users");
$data=array(
'user_login' => '',
'user_email' => '',
'mobile' =>$mobile,
'user_nicename' =>'',
'user_pass' => sp_password($password),
'last_login_ip' => '',
'create_time' => date("Y-m-d H:i:s"),
'last_login_time' => date("Y-m-d H:i:s"),
'user_status' => 1,
"user_type"=>2,//會員
);
$rst = $users_model->add($data);
if($rst){
//注冊成功后頁面跳轉
$res=array('msg'=>1,'id'=>$rst);
echo json_encode($res);
}else{
$res=array('msg'=>"注冊失敗");
echo json_encode($res);
}
}
```