http://client.xyz.com/division/controller/controller_fuction
에 비해 다음과 같은 URL 구조를 구현하고자
. 감사.
코멘트 -
내가 division1, division2처럼 될 수 현명한 sepearate 데이터베이스와 '부서'설치 클라이언트 싶습니다. URL 설정에 따라 세션이로드됩니다.
http://client.xyz.com/division/controller/controller_fuction
에 비해 다음과 같은 URL 구조를 구현하고자
. 감사.
코멘트 -
내가 division1, division2처럼 될 수 현명한 sepearate 데이터베이스와 '부서'설치 클라이언트 싶습니다. URL 설정에 따라 세션이로드됩니다.
고유 한 경로 클래스를 만들어야합니다. CI를 사용하면 핵심 기능을 대체하거나 확장 할 수 있습니다. 그냥 예 :이
class MY_Router extends CI_Router
{
//so on ..
}
그런 다음 CI 당신의 클래스 대신 디폴트를 사용하는 것, application/core
폴더에 저장 만들 수 있습니다.
보기? config 파일에서 http://ellislab.com/codeigniter/user-guide/general/core_classes.html
이세트
$config['index_page'] = '';
후 적용 htacess
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|css|img|js)
RewriteRule ^(.*)$ ./index.php/$1 [L]
이 방법 당신은 당신이
당신이 할 수있는 라우팅 사용할 수 있습니다 http://client.xyz.com/division/controller/controller_fuction
처럼 할 OR 수 있습니다 MY_ 만들기 CI_Controller를 확장 할 컨트롤러.
다른 모든 컨트롤러는 MY_Controller를 확장합니다.
그러면 MY_Controller에서 이것을 생성자에서 사용할 수 있습니다.
$controller = $this->uri->segment(1);
$controller_function = $this->uri->segment(2);
여기서 $ devisions를 정의하거나 config에서 가져올 수 있습니다.
$division1 = array('controller1','controller2','controller3');
$division2 = array('controller4','controller5','controller6');
$division3 = array('controller7','controller8','controller9');
if(in_array($controller,$division1)){
//do blah blah
}else if(in_array($controller,$division2)){
//do other blah blah
}else{
//do last and final blah blah
}