|
发表于 2008-5-17 13:43:07
|
显示全部楼层
ci是不是只判断了一层目录
贴段源代码,Router.php里面的
PHP复制代码
function _validate_request ($segments)
{
// Does the requested controller exist in the root folder?
if (file_exists(APPPATH .'controllers/'.$segments[0].EXT ))
{
return $segments;
}
// Is the controller in a sub-folder?
//这里只处理一层下级目录
if (is_dir(APPPATH .'controllers/'.$segments[0]))
{
// Set the directory and remove it from the segment array
$this->set_directory($segments[0]);
$segments = array_slice($segments, 1);
if (count($segments) > 0)
{
// Does the requested controller exist in the sub-folder?
if ( ! file_exists(APPPATH .'controllers/'.$this->fetch_directory().$segments[0].EXT ))
{
show_404 ();
}
}
else
{
$this->set_class($this->default_controller);
$this->set_method('index');
// Does the default controller exist in the sub-folder?
if ( ! file_exists(APPPATH .'controllers/'.$this->fetch_directory().$this->default_controller.EXT ))
{
$this->directory = '';
return array();
}
}
return $segments;
}
// Can't find the requested controller...
show_404 ();
}
复制代码 |
|