【发布时间】:2011-04-12 00:50:42
【问题描述】:
我的 bootstrap.php 文件长这样,所有代码都嵌入到welcome controller->action_index中。
Kohana::init(array(
'base_url' => '/kohana/',
'index' => 'index.php'
));
好的,如果我将以下内容放入 action_index 中
form::open('test');
动作是/kohana/index.php/test。
所以链接似乎是你的根安装位置的绝对链接,当我在 action_index index.php 中嵌入链接时接受!!!
html::anchor('controller');
href 是 /kohana/controller 而不是 /kohana/index.php/controller。
现在如果我放
url::site('controller');
返回值为/kohana/index.php/controller。
所以我想我会使用
html::anchor(url::site('controller'));
但 href 现在等于 http://localhost/kohana/kohana/index.php/controller。
到底发生了什么,我该如何解决?
Kohana url 系统似乎很不直观且错误。
【问题讨论】:
-
你需要 index.php 还是可以不用?
-
我在安装了 apache 和 mysql 的 ubuntu 上。在我的服务器上我有 htacess 但在 localhost 上没有。如果没有 htaccess,我无法进行 url 重写,但我可以安装它。
-
将行更改为
'index' => false以使其完全一样 -
做什么都一样?要删除 index.php,我需要 htaccess