2012-04-24 3 views
0

나는CodeIgniter의 2.1.0 라우팅 어려움

http://localhost/index.php?controller/method 

와 컨트롤러를로드 할 수는 없지만 '?' 보기에서 컨트롤러를로드 한 다음 URL 생성을 복제하려고 시도합니다. 내가보기에서 폼 행동이 링크를 추가 할 경우 위의 예로서 다음 URL을

http://localhost/index.php/controller/index.php/controller/method 

어떻게 그것을 해결하는 것입니다 결과? htaccess 파일을 사용하지 않았습니다.

+0

config.php에 base_url()을 설정 했습니까? –

+0

예. http : // localhost/codeigniter_folder_name이 맞나요? – shantanu

+0

http : //localhost/index.php/controller/method가 작동합니까? –

답변

0

site_url() 함수를 사용하거나 @JohnFable 명시된대로 form_open 함수를 사용하십시오.

<form method="post" action="<?= form_open('controller/method'); ?>"> 

또는

<a href="<?= site_url('controller/method'); ?>">Controller/Method</a> 

또는

<?= form_open('controller/method'); ?> 

이 당신의 "기본 URL이", 즉 http://localhost 당신이 즉, http://localhost/index.php/controller/method 또는 경우를 보려는 URL에 올바르게 앞에 추가되어 있는지 확인합니다 최대 설정 : http://localhost/controller/method

개빈