如果我点击我的链接,我会被重定向到/ 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',
));
并且基本网址仅设置为“/”(我在根目录中有kohana)。
如何摆脱重复的控制器?
答案 0 :(得分:0)
我找到了解决这个问题的方法。 我们可以用“Route :: url(controller,params)”替换“Route :: get(controller) - &gt; uri(params)”。 但是我想知道如何做一个相对链接网址。