简体   繁体   English

如何获取没有html标签的格式化文本输出(在symfony中)?

[英]how to get a formatted text output with no html tags (in symfony)?

I'm working on a first symfony project, i am using the sfWidgetFormTextareaTinyMCE widget for a form tinymce text area. 我正在做第一个symfony项目,我正在将sfWidgetFormTextareaTinyMCE小部件用于表单tinymce文本区域。 It works fine, but while retrieving from database, instead of showing me the formated text, i have the <strong>,<p>,<br> tags in the text. 它工作正常,但是在从数据库中检索时,我没有显示格式化的文本,而是在文本中具有<strong>,<p>,<br>标签。 help me please 请帮帮我

You have output escaping turned on in your application. 您已在应用程序中打开了输出转义 To avoid it for that specific output you can use the $sf_data->getRaw() method available in your templates like this: 为了避免针对特定的输出,您可以使用模板中可用的$sf_data->getRaw()方法,如下所示:

<?php echo $sf_data->getRaw('html'); ?>

That is assuming that the raw HTML you wanted to display is stored in $html within the template by your action: 假设您要显示的原始HTML通过您的操作存储在模板中的$ html中:

$this->html = $object->getHtml();

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM