[英]Symfony render template to string
有没有办法在行动中将完全渲染的模板(有或没有布局)作为字符串?
即沿着这些方向的东西:
public function executeMyAction()
{
$this->variable1 = 'foo';
$this->variable2 = 'bar';
// renders template using assigned variables, partials, layouts, etc. as if it was for output to browser, but assigns html to string
$renderedTemplate = $this->renderTemplateToString();
}
PS我知道这个问题 ,但是答案提供给我的目的并没有那么好。 链接不起作用,getPartial获取模板文件而不进行渲染。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.