[英]How to Give Link In Menu to go menu page (laravel 4.2)
朋友您好感謝您查看我的問題!
我無法激活菜單鏈接
<div class="sign-up-right">
<a href="{{ URL::route('singup') }}">Sign Up</a>
</div>
我的控制器文件(MyCon.php)
public function singup(){
return View::make('preview',['preview'=>'signup.php']);
}
我的路線文件代碼
Route::get('/', 'MyCon@index');
route::get('admin', array('user'=>'Admin@index'));
Route::get('/login',function(){ return View::make('preview',['preview'=>'login.php']);});
Route::get('singup', ['as' => 'signup', 'uses' => 'MyCon@signup']);
但是當我單擊“注冊”鏈接時,它顯示錯誤提示
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
return new Response('', 200, array('Allow' => implode(',', $others)));
}))->bind($request);
}
$this->methodNotAllowed($others);
}
protected function methodNotAllowed(array $others)
{
throw new MethodNotAllowedHttpException($others);
}
protected function check(array $routes, $request, $includingMethod = true)
請幫助使我的鏈接成功謝謝
嘗試給您的路線起個名字可能會解決您的問題
Route::post('singup', function(){ return View::make('preview',['preview'=>'signup.php']);});
由於您使用的是簡單a href
鏈接,因此需要將路由更改為Route::get
:
Route::get('singup', ['as' => 'signup', 'uses' => 'MyCon@signup']);
另外,修復鏈接:
<a href="{{{ URL::route('signup') }}}">Sign Up</a>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.