简体   繁体   中英

Twig reports “An exception has been thrown during the rendering of a template” in Laravel

I am getting this error in Laravel:

Twig \\ Error \\ RuntimeError An exception has been thrown during the rendering of a template ("Route [shortname.shortname_list] not defined.") in "common.sidebar.vendor.twig" at line 154.

I already checked my sidebar.twig, route list and controller, it seems like fine.

What does this error mean, and what is a possible solution?

在此处输入图片说明

This error means that a route with the name shortname.shortname_list isn't defined in your route configuration.

You need to ensure that you have a route with the name shortname.shortname_list to be able to generate a URL for it in twig.

Route::get('route-path', ['uses' => 'Controller@method'])
    ->name('shortname.shortname_list');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM