刚刚看CodeIgniter源代码,2.2.0版本,看到这么个函数:

1
2
3
4
5
function system_url()
{
$x = explode("/", preg_replace("|/*(.+?)/*$|", "\\1", BASEPATH));
return $this->slash_item('base_url').end($x).'/';
}

愣了好一会儿才反应过来,其实就是trim(BASEPATH, ‘/‘)吧?