Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Codeigniter 编码点火器->;URI类,更具体;uri->;uri_字符串()_Codeigniter_Url - Fatal编程技术网

Codeigniter 编码点火器->;URI类,更具体;uri->;uri_字符串()

Codeigniter 编码点火器->;URI类,更具体;uri->;uri_字符串(),codeigniter,url,Codeigniter,Url,对于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/' (le

对于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\u string()
输出:afsgasg/sasga吗? 我做错了什么

My routes.php配置
My.htaccess与index.php位于同一文件夹中
My config.php config
如果有进一步的信息需要,我很乐意提供

$this->uri->uri_string()
返回具有完整URI的字符串。例如,如果这是您的完整URL:

函数将返回以下内容:

新闻/本地/345

查看

所以在您的例子中::url是

http://localhost/dropbox/derrek/shopRedux/#something#

因此它将输出
“dropbox/derrek/shopRedux/#something#”

uri#u string()不考虑基本url吗?那么它不应该包括localhost吗?也就是说,在我的情况下,我希望“”被视为与www.shopRedux.com/相同。在这种情况下,您应该将虚拟主机指向该位置,意味着将您的shopRedux虚拟主机指向此位置“localhost/dropbox/derrek/shopRedux/”您是否仍面临任何问题?
$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';
$this->uri->uri_string()
http://localhost/dropbox/derrek/shopRedux/#something#