Laravel Study II: Executive Route:cache Times logicexception

Source: Internet
Author: User
Tags closure

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.