如果我点击链接,我会被重定向到/podstrony/podstrony/xyz。
我尝试通过以下方式与方法"Route::get()->uri()"建立链接:
$url = Route::get('podstrony')->uri(array(
'title' => 'xyz',
));
我把它设置为低于
$view->body = __('Example text').'<a href="'.$url.'">click</a>';
$this->response->body($view);
bootstrap.php中的路由看起来像
Route::set('podstrony', 'podstrony(/<title>)')
->defaults(array(
'controller' => 'podstrony',
'action' => 'index',
));
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'welcome',
'action' => 'index',
));
并且基本url仅设置为"/"(我在根目录中有kohana)。
如何摆脱重复控制器?
我找到了这个问题的一些解决方案。我们可以将"Route::get(controller)->uri(params)"替换为"Route::url(controller,params)。然而,我想知道如何做一个相对的链接网址。