0
내가 CodeIgniter의 나머지 모듈을 테스트하고 있습니다
는 여기 내 간단한 GET 기능입니다 :CodeIgniter의 쿼리
function test_get()
{
if(!$this->get('id'))
{
$this->response(NULL, 400);
}
$query = $this->db->query('select * from test');
$users = $query->result();
$user = @$users[$this->get('id')];
if($user)
{
$this->response($user, 200); // 200 being the HTTP response code
}
else
{
$this->response(array('error' => 'User could not be found'), 404);
}
}
그것은 지금까지 작동합니다,하지만 난 모르겠어요 이유를 '나는 결과로 아이디 (3)를 받고 있어요 http://.../test/id/2을 열 때 나는 http://.../test/id/1
<xml><id>2</id><attribut1>Testdata</attribut1><attribut2>asdfasdf</attribut2><testcol>asf</testcol></xml>
를 열 때 결과로 ID 2를 받고 있어요.
이럴 필요가 없습니다. http://.../test/id/1 -> id 1?
물론 배열은 0입니다. 귀하의 예가 해결책입니다. 고마워요 :) – milepile