阻止symfony从查询结果中转义html

时间:2010-08-30 17:40:22

标签: symfony1 symfony-forms

目前我在Symfony中使用ckEditor和ckFinder。当我保存表单时,HTML在数据库中正确保存(看似如此)。当我通过symfony查询并检索结果时,将删除并替换html标记。我可以阻止这个吗?下面是数据库中的内容示例。我尝试输入HTML节目,但当前的eidtor翻译它

数据库显示:

<p> Test</p> <p> <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="quality" value="high" /><param name="movie" value="/uploads/flash/test1.flv" /><embed pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" src="/uploads/flash/test1.flv" type="application/x-shockwave-flash"></embed></object></p>

Actaul HTML(注意我已全部替换;使用__,因为编辑器正在将其翻译为上述内容):

&安培; lt__p&安培; gt__  试验&安培; LT __ / P&安培; gt__ &安培; lt__p&安培; gt__  &amp; lt__object classid =&amp; quot__clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&amp; quot__ codebase =&amp; quot__http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6, 0,40,0&amp; quot __&amp; gt __&amp; lt__param name =&amp; quot__quality&amp; quot__ value =&amp; quot__high&amp; quot__ /& amp; gt __&amp; lt__param name =&amp; quot__movie&amp; quot__ value =&amp; quot __ / uploads / flash / test1。 flv&amp; quot__ /&amp; gt __&amp; lt__embed pluginspage =&amp; quot__http://www.macromedia.com/go/getflashplayer& quot__ quality =&amp; quot__high&amp; quot__ src =&amp; quot __ / uploads / flash / test1.flv&amp; quot__类型=安培; quot__application / X - 冲击波闪光&安培; QUOT __&安培; GT __&安培; LT __ /嵌入&安培; GT __&安培; LT __ /对象&安培; GT __&安培; LT __ / p&安培; GT __

1 个答案:

答案 0 :(得分:3)

你必须打开自动输出转义并在模板中回显查询结果我猜。阅读here自动输出转义是什么以及如何使用ESC_RAW常量或getRaw()方法可以帮助您。