Url控制器操作未覆盖


Url controller action not overwriting

好吧,这是我的问题。如何重置url,以便每次执行操作时都覆盖url。我用的是kohana 3.3。

下面是一个示例场景。

基本网址:

localhost/kohana_app/

注册表

<form action="user/create" method="POST">
<input type="text" name="email" />
<input type="password" name="password" />
<input type="submit" value="Register" />
</form>

按下提交按钮,将我重定向到登录页面,现在url变为。

localhost/kohana_app/user/create

登录表单

<form action="user/login" method="POST">
<input type="text" name="email" />
<input type="password" name="password" />
<input type="submit" value="Login" />
</form>

现在我按下登录按钮,然后我得到一个错误,那就是

View_Exception [ 0 ]: The requested view errors/404 could not be found

当然,这是意料之中的,因为完整的网址现在是。

localhost/kohana_app/user/user/login

我如何让它将url重置为基础,这样每次点击按钮都会覆盖控制器和操作url?

感谢和更多的力量

您需要在操作开始时放入一个基本URL变量。我刚刚看了Kohana的文档,看起来你应该这样做:

<form action="<?=URL::base()?>/user/login" method="POST">