Php 找到所有路线,拉威尔4号

Php 找到所有路线,拉威尔4号,php,routing,laravel,laravel-4,Php,Routing,Laravel,Laravel 4,我现在只想使用一个控制器,它可以处理我的Laravel4应用程序的每个请求。问题是stackoverflow或其他方面的解决方案都不适合我 这就是我目前拥有的: Route::any('(.*)', function(){ return View::make('hello'); }); 现在,每次浏览页面时,我都会收到一个错误,上面说: Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException 希望有人能帮我

我现在只想使用一个控制器,它可以处理我的Laravel4应用程序的每个请求。问题是stackoverflow或其他方面的解决方案都不适合我

这就是我目前拥有的:

Route::any('(.*)', function(){
  return View::make('hello');
});
现在,每次浏览页面时,我都会收到一个错误,上面说:

Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException

希望有人能帮我

正则表达式按要求设置,而不是直接在路由中设置

Route::any('{all}', function($uri)
{
    return View::make('hello');
})->where('all', '.*');
//在filters.php中

Route::filter('MAKEYOUROWNFILTER', function()
{

    // do stuff or just
    return View::make('hello');

});
扩展#Jason Lewis关于重定向到根页面的回答:

Route::any('{all}', function($uri)
{
    return Redirect::to('/');
})->where('all', '.*');

谢谢。如何在这里使用例如“TestController”而不是直接返回视图?相同的处理,但不是使用闭包作为第二个参数,您将执行
Route::any(“{all}”,”TestController@method');
不需要通过
any
,它可以是
get
post
或另一个HTTP动词(等:如果您想捕获所有
get
,而不是任何其他动词)。这只适用于它出现的单个段。如果我去site.com/asdadasd就可以了,但是site.com/asdadadasd/adadssa不起作用。有什么想法吗?这也有助于理解这个解决方案
Route::any('{all}', function($uri)
{
    return Redirect::to('/');
})->where('all', '.*');