在CI中,当我这样做:
var_dump($this->uri->uri_string());
var_dump($this->config->item('base_url'));在控制器all和方法index()中,我得到以下输出:
string 'dropbox/derrek/shopredux/afsgasg/sasga' (length=36)
string 'http://localhost/dropbox/derrek/shopRedux/' (length=40)$this->uri->uri_string()不应该输出: afsgasg/sasga吗?我做错了什么?
我的routes.php配置
$route['(:any)'] = 'all/index/$1';
$route['default_controller'] = 'all/index';
$route['404_override'] = ''; My .htaccess在与index.php相同的文件夹中
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [PT,L]我的config.php配置
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';如果有进一步的信息需要,我很乐意提供。
发布于 2012-09-03 12:34:26
$this->uri->uri_string()返回具有完整URI的字符串。例如,如果这是您的完整URL:
http://example.com/index.php/news/local/345函数将返回以下内容:
新闻/本地/345
去guide/libraries/uri.html看看吧
所以在你的例子中::url是
http://localhost/dropbox/derrek/shopRedux/#something#所以它将输出"dropbox/derrek/shopRedux/#something#"
https://stackoverflow.com/questions/12247823
复制相似问题