Closed 18871434218 closed 9 months ago
你可以创建带参数构造函数的Controller,AutoCreation模板参数置为false,然后手工创建后注册进框架。Routing还可以在controller头文件设置,不影响。如:
你可以创建带参数构造函数的Controller,AutoCreation模板参数置为false,然后手工创建后注册进框架。Routing还可以在controller头文件设置,不影响。如:
但这样是不是意味着每个控制层需要参数都要这样注册传参,而我想要的是注册一个全局参数,然后每个控制层都能自动获取这个
那你可以自己写个Drogon的Plugin,提供全局参数的接口。或者自己定义个单例,plugin配置装载比较方便
Notice If you need support or clarification regarding the usage of Drogon in your project, visit the official Drogon support channel at gitter
Please create a new issue only if you think you have found a bug or if have a feature request/enhancement.
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like A clear and concise description of what you want to happen.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.