的应用程序
变量(的一个实例<一个href=”https://github.com/symfony/symfony/blob/5.2/src/Symfony/Bridge/Twig/AppVariable.php" class="reference external" title="AppVariable”rel=”external noopener noreferrer" target="_blank">AppVariable>)允许您访问这些变量:
-
app.user
-
的<一个href=”//www.oldmanjams.com/doc/5.2/security.html" class="reference internal">当前用户对象>或
零
如果用户未被认证。 -
app.request
- 的<一个href=”https://github.com/symfony/symfony/blob/5.2/src/Symfony/Component/HttpFoundation/Request.php" class="reference external" title="请求”rel=”external noopener noreferrer" target="_blank">请求>对象存储当前<一个href=”//www.oldmanjams.com/doc/5.2/components/http_foundation.html" class="reference internal">请求数据>(取决于您的应用程序,这可能是一个<一个href=”//www.oldmanjams.com/doc/5.2/components/http_kernel.html" class="reference internal">sub-request>或常规请求)。
-
app.session
-
的<一个href=”https://github.com/symfony/symfony/blob/5.2/src/Symfony/Component/HttpFoundation/Session/Session.php" class="reference external" title="会话”rel=”external noopener noreferrer" target="_blank">会话>表示当前对象<一个href=”//www.oldmanjams.com/doc/5.2/session.html" class="reference internal">用户的会话>或
零
如果没有。 -
app.flashes
-
所有的数组<一个href=”//www.oldmanjams.com/doc/5.2/controller.html" class="reference internal">flash的消息>存储在会话中。你也可以只有某种类型的消息(如。
app.flashes(“通知”)
)。 -
app.environment
-
当前的名称<一个href=”//www.oldmanjams.com/doc/5.2/configuration.html" class="reference internal">配置环境>(
dev
,刺激
等等)。 -
app.debug
- 如果在<一个href=”//www.oldmanjams.com/doc/5.2/configuration/front_controllers_and_kernel.html" class="reference internal">调试模式>。否则错误。
-
app.token
- 一个<一个href=”https://github.com/symfony/symfony/blob/5.2/src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php" class="reference external" title="TokenInterface”rel=”external noopener noreferrer" target="_blank">TokenInterface>对象表示安全令牌。
除了全球性的应用程序
变量注入Symfony,你也可以欧宝娱乐app下载地址<一个href=”//www.oldmanjams.com/doc/5.2/templating/global_variables.html" class="reference internal">注入所有树枝模板自动变量>。