假设你已经有了
routes.yaml
文件在
config
项目文件夹,只需添加以下内容(
对于每个控制器全局资源文件夹(如果有多个)
):
#index:
# path: /
# defaults: { _controller: 'App\Controller\DefaultController::index' }
_controllers:
resource: ../src/YourControllerFolder/
type: annotation
schemes: "https" <--- this line
此配置将从存储的任何控制器加载注释
在src/Controller/目录中,甚至在其子目录中。
将它们重新组织成子目录
Routing Configuration Reference