The LARAVEL5 route supports caching. You need to execute the following command:
phpartisanroute:cache
After execution, report the following error:
for serialization. Uses Closure.
This abnormal error message, the hint is already very clear: the approximate meaning is that in the closure of the inside, is not able to do the route cache. Then there are two ways to do it now:
① want to continue using closures, you can only abandon the routing cache (at least for now I have no other way, if you have, remember to tell me).
② that is in the routing inside, that is, route.php, do not use closures, all changed to the controller.
Specific examples:
// 之前,报错的路由Route::get(‘/‘function(){ return veiw(‘welcome‘);});// 修改之后,能够路由缓存的方式Route::get(‘/‘‘[email protected]‘);
It's done right now. Once again, php artisan route:cache
you can see the message prompt for success:
Routecachecleared!Routescachedsuccessfully!
Laravel Study II: Executive Route:cache Times logicexception