【发布时间】:2016-09-09 13:11:27
【问题描述】:
我正在使用 restful 为我的 android 应用创建网络服务。我在我的应用中使用 Facebook 按钮登录,我想存储他们 Facebook 帐户中的用户数据。
public function sotrefacebookuser_get(){
$data[] = base64_decode($this->uri->segment(3));
if(!empty($data) && $data != ""){
$userid = $this->Api_model->savefacebookuser($data);
if(!empty($userid)){
$this->response(array('status'=>'success', 'massage'=> 'Your Record Save successfully'));
} else {
$this->response(array('status'=>'failure', 'massage'=> 'The specified data could not saved try again letter'), REST_Controller::HTTP_NOT_FOUND);
}
}
else {
$this->response(array('status'=>'failure', 'massage'=> 'The specified data could not be found'), REST_Controller::HTTP_NOT_FOUND);
}
}
上面的代码是我的 API 控制器,它工作正常,但我知道,这不是正确的方法。
这是我的模型代码。
public function savefacebookuser($data){
$this->_table = "front_user";
return $this->insert($data, FALSE);
}
restful中如何使用post方法保存数据?
【问题讨论】:
标签: web-services codeigniter rest restful-authentication