在Twig模板中獲取 request參數

app.request.server.get('HTTP_X_REQUESTED_WITH') 就是 $_SERVER['HTTP_X_REQUESTED_WITH']php


相關的參數 或者 變量 常量session


Symfony\Component\HttpKernel\Kernel
Symfony\Component\HttpFoundation\Request
Symfony\Component\Security\Core\SecurityContext
Symfony\Component\HttpFoundation\Session
Symfony\Component\Security\Core\Authentication\Token\TokenInterface::getUserapp


能夠在twig中獲取的url


例如code

{{app.kernel.cachedir}}
{{app.kernel.logdir}}
{{app.kernel.rootdir}}
{{app.request.basepath}}
{{app.request.baseurl}}
{{app.request.uri}}
{{app.security.token.user}}
{{app.session.locale}}
相關文章
相關標籤/搜索