Symfony的方法打开模板为String模板、方法、Symfony、String

2023-09-11 22:31:27 作者:仙音惜琴瑟

我使用的Symfony PHP MVC框架。我使用JSON传递一个Ajax响应,我需要一个动作的HTML模板要传递的价值观之一。难道Symfony的有沿rend​​erTemplateToString的线路()的方法?

I use the Symfony PHP MVC framework. I'm using JSON to pass an AJAX response, and I need an action's template HTML to be one of the values passed. Does Symfony have a method along the lines of renderTemplateToString() ?

即使对于那些不熟悉的Symfony,有一个明显的方式做到这一点?

Even for those unfamiliar with Symfony, is there an obvious way to do this?

推荐答案

使用的 sfAction :: getPartial() 和的 getComponent()