drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.44k stars 1.1k forks source link

怎么在drogon().app().run() 传递一个自定义全局参数,然后在每个controller层都能获取改参数变量进行其他操作呢? #1850

Closed 18871434218 closed 9 months ago

18871434218 commented 10 months ago

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.

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

hwc0919 commented 10 months ago

为何需要用 app.run() 传递? 直接定义一个全局变量就可以了