为什么$this->post('username')
无法读取来自其他客户端的输入?
在我的服务器控制器中:
function login_post(){
$data['username']=$this->post('username');
$data['password']=$this->post('password');
if ($this->get('cobak')==1) {
$cek = $this->model_user->ambilPengguna($data);
}
if ($cek) {
$this->response($cek, 200); // 200 being the HTTP response code}
else {
$this->response(array('error' => 'User could not be found'), 404);
}
}
我的模特:
public function ambilPengguna($data) {
$this->db->select('*');
$this->db->from('tbl_user');
$this->db->where($data);
$query = $this->db->get();
return $query->num_rows();
}
这是我的客户控制器:
public function proses_login(){
$data = array(
'username' => $this->input->post('username'),
'password' => $this->input->post('password')
);
$cek = $this->rest->post('login/cobak/1/format/php/');
echo $cek;
}
查询结果为5.表示读取数据库表中的所有记录