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
欢迎/cat/0 can';t访问controller welcome.php codeigniter中的方法cat()_Php_Codeigniter - Fatal编程技术网

欢迎/cat/0 can';t访问controller welcome.php codeigniter中的方法cat()

欢迎/cat/0 can';t访问controller welcome.php codeigniter中的方法cat(),php,codeigniter,Php,Codeigniter,我有一个控制器welcome.php和一个方法cat()。这是查询字符串http://localhost/CodeIgniterhi/?welcome/cat/0。当我点击该链接时,我无法访问controllerwelcome.php中的方法cat()。为什么?有路由问题吗?我的默认路由器是welcome/index。假设您从url中删除了index.php,问题是url中有查询字符 /CodeIgniterhi/?welcome/cat/0 应该是 /CodeIgniterhi/welcom

我有一个控制器
welcome.php
和一个方法
cat()
。这是查询字符串
http://localhost/CodeIgniterhi/?welcome/cat/0
。当我点击该链接时,我无法访问controller
welcome.php
中的方法
cat()。为什么?有路由问题吗?我的默认路由器是welcome/index。

假设您从url中删除了
index.php
,问题是url中有查询字符

/CodeIgniterhi/?welcome/cat/0
应该是

/CodeIgniterhi/welcome/cat/0
如果您遇到无法删除查询字符的问题
,则应尝试在
config/config.php
中启用以下功能:

$config['uri_protocol'] = 'QUERY_STRING';

因为在url中使用查询字符串并非最佳做法,它们看起来不利于SEO

这可能是因为url中缺少index.php,请尝试此地址:除非您已使用htaccess文件删除了它并更改了配置文件,否则,请忽略上述内容,也请发布您的控制器。您是否从url中删除了index.php?