2014-01-30 33 views
0

我嘗試使用重定向操作重定向所有404錯誤。 在routes文件我添加這些行在laravel 4中重定向操作結果錯誤

App::missing(function($exception) { 
     Redirect::action('[email protected]'); 
    }); 

和LoginController中我有行動getError 但是它導致一個錯誤

Error in exception handler: Route [[email protected]] not defined. in 
D:\xampp\htdocs\mysite\vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator. 
php:209 

但是我對這些線路沒有問題

App::missing(function($exception) { 
     return Response::view('pages.error', array(), 404); 
    }); 

請幫忙

+0

您是否有一個寧靜的控制器或沒有?你可以用你的LoginController更新這個問題嗎? –

+0

@Andreo Vieira謝謝你的回覆。現在我得到了點 – manuthalasseril

回答

2

在你的第二個aproach你只是渲染一個視圖,但在第一個你試圖引用一個不存在的路線。嘗試先定義它,它應該工作。請記住composer dump-autoload更改routes.php

Route::get('pathwhatever/error', array('as'=>'error', 'uses' => '[email protected]')); 
App::missing(function($exception) { 
      Redirect::action('[email protected]'); 
     }); 
+0

感謝您的答覆 – manuthalasseril