CI 묻고 답하기

제목 submit 한 후 index페이지를 불러오려면?
글쓴이 cleansugar 작성시각 2009/07/24 01:11:12
댓글 : 5 추천 : 0 스크랩 : 0 조회수 : 27484   RSS

hello.php:

funtion Hello()
{}

function index()
{}

function submit()
{
$name = $this->input->post(‘formname’);
$this->hello_model->insertData($name);
Hello::index();
}

submit() 페이지를 로딩한 다음 index페이지를 다시 불러오려고 합니다.
그런데 문제는 Hello::index();로 하면 메모리에 그냥 남아있는 상태로 리커시브하게 불러오게 됩니다.
어떻게 해야 메모리에 남지 않고 깔끔하게 index로 돌아갈 수 있을까요?

redirect()도 써봤는데 index를 중복해서 로딩했다고 에러가 나옵니다.

 다음글 jquery사용에 관해서 답변좀 부탁 드려요 (2)
 이전글 foreach를 쓰지 않고 쿼리 가져오는 법은? (3)

댓글

마냐 / 2009/07/24 01:38:37 / 추천 0

리다이렉트를 hello로 하시면 됩니다.
hello 컨트롤러를 불러올때 함수명을 지정하지 않으면 기본으로 index를 불러오게 됩니다.

변종원(웅파) / 2009/07/24 07:28:13 / 추천 0
마냐님 설명 보충

//url헬퍼 로딩
$this->load->helper('url');

redirect('/hello/index');
cleansugar / 2009/07/24 13:13:29 / 추천 0
redirect('/hello/index'); 이걸 하니까 다음과 같은 에러가 납니다.

어떻게 해야 할까요?


A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\hello\system\application\models\hello_model.php:29)

Filename: helpers/url_helper.php

Line Number: 541

cleansugar / 2009/07/24 13:26:07 / 추천 0
자답: hello_model 29번째줄에서 echo문이 있었기 때문에 중복이 되어 에러가 난 겁니다.
cleansugar / 2009/07/24 13:26:59 / 추천 0
여러분 친절한 답변 감사합니다.