问题
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() ?
Even for those unfamiliar with Symfony, is there an obvious way to do this?
回答1:
Use sfAction::getPartial() and getComponent().
来源:https://stackoverflow.com/questions/1926041/symfony-method-to-turn-template-to-string