简体   繁体   中英

symfony No route found for GET

No route found for "GET /category/wordone-wordtwo"

This is the error I get when I try to access

http://localhost/site/web/app_dev.php/category/wordone-wordtwo

Routing.yml:

csa_platform_category:
path:     /category/{slug}
defaults: { _controller: CSAPlatformBundle:Category:index }
requirements:
    slug: "~^[a-z]+(?:-[a-z]+)*$~"

this requiremens slug for slugs like (wordone-wordtwo-wordtree)

All routes work good. except this route: csa_platform_category

What if you get rid of the Tilde (~) and the double quotes:

csa_platform_category:
   path:     /category/{slug}
   defaults: { _controller: CSAPlatformBundle:Category:index }
   requirements:
      slug: '^[a-z]+(?:-[a-z]+)*$'

Try it - I'm not sure if that makes any difference.

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