CI를 통해 추적합니다. 당신이 할 수 없다는 것을 알게됩니다.
이러한 요소는 라이브러리 (클래스) 파일보기, 도우미, 모델이 될 수 있으며, 특히, http://codeigniter.com/user_guide/libraries/loader.html에서 알 수 있듯이 : 당신은 응용 프로그램/컨트롤러 /의 하위 디렉토리에 자신의 컨트롤러를 넣을 수 있습니다,하지만 당신은 어딘가 다른 넣어 수 없습니다 , 또는 자신의 파일.
"자신의 파일"에는 컨트롤러가 포함되지 않습니다. 결국 CodeIgniter.php 및 Router.php를 변경하여 APPPATH 외에도 ENVIRONMENT 설정을 살펴볼 수있게되었습니다. 그러나 이런 변화를 싫어하므로 변경 사항을 취소했습니다. 다른 사람들이 그 혜택을 누릴 수 있기를 바랍니다.
Router.php 변화 :
function _validate_request($segments)
{
...
// Does the requested controller exist in the root folder?
if (file_exists(APPPATH.'controllers/'.$segments[0].'.php')
|| file_exists(ENVIRONMENT.'/controllers/'.$segments[0].'.php')) // New bit here
{
return $segments;
}
....
}
CodeIgniter.php 변화, '라인 (246)에 대한 라운드 :
if (! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'))
{
// New bit here
if (! file_exists(ENVIRONMENT.'/controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php'))
{
show_error('Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.');
}
include(ENVIRONMENT.'/controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php');
} else {
include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php');
}