gpt4 book ai didi

controller - 在 Twig 中渲染 Controller - 意外的 "render"标签 - 期望定义的 "block"标签的结束标签

转载 作者:行者123 更新时间:2023-12-02 18:44:26 24 4
gpt4 key购买 nike

在 Symfony2 中,至少在 Symfony 2.4 之前,可以在 twig 中渲染这样的 Controller

{% render(controller("MyBundle:Default:method", { 'call' : 'action' })) %}

对于 Symfony 3,这会引发异常

Unexpected "render" tag (expecting closing tag for the "block" tag defined

最佳答案

我花了一些时间寻找解决方案,但它很简单,所以我与你分享。也许它可以节省某人的时间

{{ render(controller("MyBundle:Default:method", { 'call' : 'action' })) }}

很简单,不是吗?

关于controller - 在 Twig 中渲染 Controller - 意外的 "render"标签 - 期望定义的 "block"标签的结束标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38751424/

24 4 0