0

我的 CI 配置中缺少 Tank auth 视图文件所期望的“/”,我无法弄清楚。我希望你可以!

以下是一些细节: $config['base_url'] = 'http://localhost/CI/';

我没有设置 .htaccess(所以我的 URI 中仍然有 index.php)

当 Tank auth 加载其中一个视图文件时,第一行如下: <?php echo form_open($this->uri->uri_string()); ?>

生成的 URI 无法加载,因为它读取为 "http://localhost/CI/index.php?auth/register而不是http://localhost/CI/index.php/auth/register

但是,如果我将其修改为: <?php echo form_open("/".$this->uri->uri_string()); ?> 一切都很好。但现在这就是它的工作方式!我错过了什么?

谢谢!

4

1 回答 1

1

为什么不直接使用 .htaccess 删除 index.php?这将解决问题并为您提供更清晰的 URL。

这不是我在本地主机上安装 Tank Auth 时使用的重写。

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /~Steve/_sandbox/tank_auth/index.php/$1 [L]

ErrorDocument 404 /index.php
于 2012-02-04T05:19:08.110 回答