symfony 4中的路由
我想为我的应用程序和api创建如下路由:symfony 4中的路由,symfony,annotations,symfony4,Symfony,Annotations,Symfony4,我想为我的应用程序和api创建如下路由: app: resource: ../src/Controller type: annotation prefix: / api: resource: ../src/Controller/Api type: annotation prefix: /api Q1:我应该在哪里写这个?在config/routes/annotations.yaml或 config/routes.yaml Q2:这两个文件之间有
app:
resource: ../src/Controller
type: annotation
prefix: /
api:
resource: ../src/Controller/Api
type: annotation
prefix: /api
Q1:我应该在哪里写这个?在config/routes/annotations.yaml
或
config/routes.yaml
Q2:这两个文件之间有什么不同,使用哪一个文件?文件
config/routes/annotations.yaml
可能是在应用注释时由flex创建的。我不是100%确定,但是当你想删除注解包时,它也会删除这个文件
但对我来说,将所有注释路由导入到config/routes/annotations.yaml
文件是有意义的,因为它们只依赖于这个包
您应该将其他路由放入config/routes.yaml
文件中