我在表单帖子的操作中对 url 有一点问题。我的表格看起来像这样
<form action="../method" type="POST">
<input type="submit" value="Submit">
</form>
我的方法看起来像
function method()
{
$bool=dosomething();
if($bool)
{
$this->redirect('mainpage');
}
else
{
$this->redirect('currentpage');
}
}
如果 $bool 值被评估为 false,我希望我的按钮按下事件将我引导到当前页面。但是我第一次访问当前页面时,url 是例如http://localhost/dir/controllers/method
当我将鼠标悬停在提交按钮上但是当上面的 $bool 变为 false (第二次重新加载)时,上面按钮的执行 url 变为http://localhost/dir/method
.
我现在应该解决什么问题?