使用 Symfony 本地服务器时弃用 ServerBundle

Cl0*_*ent 6 php symfony

我正在使用 Symfony 4.4.2
当我使用服务器包运行服务器时......

./bin/console server:run
Run Code Online (Sandbox Code Playgroud)

...我收到弃用警告:

User Deprecated: Using the WebserverBundle is deprecated since Symfony 4.4. The new Symfony local server has more features, you can use it instead.
Run Code Online (Sandbox Code Playgroud)

所以我安装了 Symfony 本地服务器,现在我正在使用它:

User Deprecated: Using the WebserverBundle is deprecated since Symfony 4.4. The new Symfony local server has more features, you can use it instead.
Run Code Online (Sandbox Code Playgroud)

但是,弃用仍然存在。
为什么?

mxl*_*lhz 17

你已经在你的项目中包含了 WebserverBundle 包,但是这个包将在 Symfony 4.4 之后被弃用。正如 Cerad 解释的那样,包本身很好,您现在仍然可以使用它,但这只是意味着如果您将项目更新到 Symfony 5,您将无法再使用它。

如果您不使用捆绑包并希望摆脱弃用消息,只需运行以下命令:

composer remove symfony/web-server-bundle
Run Code Online (Sandbox Code Playgroud)