问题
I'm currently upgrading a custom CMS from Laravel 3 to Laravel 4 (this upgrade is important for various reasons).
In the existing version, it has routing set up so that routes can be individually defined--but if someone tries to load a route that is not specifically defined, the system catches it and sends it to a "page processor"--which essentially checks to see if the CMS page/post exists in the database.
The "fallback" or "default" route processing line in Laravel 3 looked like this:
Route::get('(.*)', array('uses' => 'myPageLoading@method'));
My problem is that this syntax is not supported in Laravel 4. How do I do this in Laravel 4?
回答1:
Got it.
Laravel 4 Syntax:
Route::any('{all}', array('uses' => 'myPageLoading@method'))->where('all', '.*');
来源:https://stackoverflow.com/questions/18646606/how-do-i-define-a-default-fallback-route-in-laravel