继续 codeigniter.php
line 248 include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->fetch_class().'.php');
这句话就是加载跟当前类同名的控制器
line 262 $class = $RTR->fetch_class();
line 263 $method = $RTR->fetch_method();
路由加载默认的类和方法名(默认是index)
line 300 - line340
if (method_exists($CI, '_remap'))
{
$CI->_remap($method, array_slice($URI->rsegments, 2));
}
else
{
// is_callable() returns TRUE on some versions of PHP 5 for private and protected
// methods, so we'll use this workaround for consistent behavior
if ( ! in_array(strtolower($method), array_map('strtolower', get_class_methods($CI))))
{
// Check and see if we are using a 404 override and use it.
if ( ! empty($RTR->routes['404_override']))
{
$x = explode('/', $RTR->routes['404_override']);
$class = $x[0];
$method = (isset($x[1]) ? $x[1] : 'index');
if ( ! class_exists($class))
{
if ( ! file_exists(APPPATH.'controllers/'.$class.'.php'))
{
show_404("{$class}/{$method}");
}
include_once(APPPATH.'controllers/'.$class.'.php');
unset($CI);
$CI = new $class();
}
}
else
{
show_404("{$class}/{$method}");
}
}
// Call the requested method.
// Any URI segments present (besides the class/function) will be passed to the method for convenience
call_user_func_array(array(&$CI, $method), array_slice($URI->rsegments, 2));
}
这段是调用控制器中的方法。
get_class_methods 获取类中的方法
call_user_func_array 调用指定的方法
get_object_vars 对象 转换成数组
if ($EXT->_call_hook('display_override') === FALSE)
{
$OUT->_display();
}
将结果输出到浏览器
if (class_exists('CI_DB') AND isset($CI->db))
{
$CI->db->close();
}
如果数据库打开 关闭数据库连接
codeigniter.php 结束了,一个程序也就运行完了