You can use parameter substitution in the twig globals section of the config:
Parameter config:
parameters:
app.version: 0.1.0
Twig config:
twig:
globals:
version: '%app.version%'
Twig template:
{{ version }}
This method provides the benefit of allowing you to use the parameter in ContainerAware
classes as well, using:
$container->getParameter('app.version');
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…