【问题标题】:CodeIgniter : No input file specified : PATH_INFO : $_GETCodeIgniter:未指定输入文件:PATH_INFO:$_GET
【发布时间】:2011-07-10 18:41:16
【问题描述】:

当我使用时:

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);

现在不行

【问题讨论】:

    标签: apache .htaccess codeigniter get pathinfo


    【解决方案1】:

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

    -- 编辑--

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

    【讨论】:

    • 是的,我不能将 cgi.fix_pathinfo 设置为 0;什么可能导致问题。设置 $config['index_page'] = "index.php?"没有任何区别;没有这个一切正常 - 问题是 - 现在如何使用/实施 $_GET?
    【解决方案2】:

    解决了...我用这个:

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

    现在我可以再次使用 $_GET

    【讨论】:

    【解决方案3】:

    升级到 CodeIgniter Reactor 2.0,$_GET 适用于大多数安装。 2.0.1 将在本周发布,提供更好的支持。

    【讨论】:

      猜你喜欢
      • 2017-07-24
      • 1970-01-01
      • 1970-01-01
      • 2014-09-11
      • 2014-02-06
      • 2011-09-01
      • 2013-01-11
      • 2013-04-08
      相关资源
      最近更新 更多