CodeIgniter:未指定输入文件:PATH_INFO:$ _GET

时间:2011-03-08 01:10:05

标签: apache .htaccess codeigniter get pathinfo

当我使用时:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|favicon\.ico|robots\.txt|class|style|js)
RewriteRule ^(.*)$ /index.php/$1 [L]

在.htaccess中:

$config['uri_protocol'] = "PATH_INFO";
在config.php中

结果是: 我的WINDOWS服务器说:一切正常,我的LINUX服务器说没有指定输入文件

所以我改变了.htaccess:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|favicon\.ico|robots\.txt|class|style|js)
RewriteRule ^(.*)$ /index.php?/$1 [L]

并在config.php中:

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

比: 一切正常但但是_GET不是!!!如何使用$ _GET进行此类设置?简单:

parse_str($_SERVER['QUERY_STRING'], $_GET);

现在不起作用

3 个答案:

答案 0 :(得分:0)

您可能正在使用fastcgi PHP,这意味着您应该查看CI的用户指南以进行问题排查:http://codeigniter.com/user_guide/installation/troubleshooting.html

- 编辑 -

我误解了这个问题。应通过CI配置启用查询字符串。 请查看此用户指南页面的底部:http://codeigniter.com/user_guide/general/urls.html

答案 1 :(得分:0)

解决了......我用过这个:

$ru = $_SERVER['REQUEST_URI'];
parse_str(substr($ru,strpos($ru,'?')+1), $_GET);

现在我可以再次使用$ _GET

答案 2 :(得分:0)

升级到CodeIgniter Reactor 2.0,$ _GET适用于大多数安装。本周2.0.1将会有更好的支持。