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
在Codeigniter中使用site_url()而不获得?在生成的URL中_Codeigniter - Fatal编程技术网

在Codeigniter中使用site_url()而不获得?在生成的URL中

在Codeigniter中使用site_url()而不获得?在生成的URL中,codeigniter,Codeigniter,我试图在Codeigniter中使用site_url(),但每次我在参数中放入一些内容(例如site_url(“controller_name”),我在链接中都会得到一个类似以下内容的url: http://{mysite}/index.php?controller_name 而不是我认为我应该得到的是: http://{mysite}/index.php/controller_name. 我在我的网页上的链接中使用了echo site_url()语法,但到目前为止我没有成功 有什么建议吗?

我试图在Codeigniter中使用site_url(),但每次我在参数中放入一些内容(例如site_url(“controller_name”),我在链接中都会得到一个类似以下内容的url:

http://{mysite}/index.php?controller_name
而不是我认为我应该得到的是:

http://{mysite}/index.php/controller_name.
我在我的网页上的链接中使用了echo site_url()语法,但到目前为止我没有成功

有什么建议吗?

不要使用site\u url()使用

它可以使用

echo base_url().'controller_name';
它给

 http://{mysite}/index.php/controller_name  format

我认为你的配置文件有问题
检查你的配置文件,这是什么

$config['uri\u protocol']='QUERY\u STRING';

然后换成这个


$config['uri\u protocol']='AUTO';

站点url不应该用于链接吗?这就是我在堆栈溢出中读到的内容…什么?我已经知道如何使用基本url,但我不是在要求解决问题,我是在问如何最好地使用站点url()函数检查您的配置文件是否为$config['uri_protocol']='QUERY_STRING';然后切换到AUTOThank you,希望您能把它作为一个答案,因为我可以增加您的销售代表的接受度谢谢,这不是完整的解决方案,但它很有帮助。我发现我需要阅读配置文件下的查询字符串调用。
 http://{mysite}/index.php/controller_name  format