Written by
codeigniter-style
on
on
[CI] Codeigniter 라우팅 규칙 간단설명
[CI] Codeigniter 라우팅 규칙 간단설명
URL을 깔끔하게 보이기 위해서
라우팅 규칙을 잘 사용해야 한다.
메뉴얼 잘 보면 정말 그대로 하면 된다.
$route['sitename'] = 'controller/index';
$route['sitename/(:any)'] = 'controller/index/$1';
$1에 (:any)가 매칭됨
class Controller extends CI_Controller { public function index($para1) { $para1 : $1 } }
$route['sitename/(:any)/(:num)'] = 'controller/index/$1/$2'; 숫자는 순서임
$1에 (:any)가 매칭됨 $2에 (:num)이 매칭됨
class Controller extends CI_Controller { public function index($para1, $para2) { $para1 : $1 $para2 : $2 } }
이런식으로 하면 잘 된다.
마지막으로 명심할 것은
라우팅 설정은 먼저 선언된 것이 나중에 선언된 것보다 우선 실행된다는 것이다.
from http://teraphonia.tistory.com/646 by ccl(A) rewrite - 2021-10-27 21:00:15