Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图编写一个有效的扩展将取决于环境。如何在扩展类中检索当前环境的名称?什么是最佳实践?
您必须在扩展构造函数中注入参数。
或者,您可以将 twig 模板中的当前环境称为app.environment.
app.environment