dpoxk64080 2011-12-19 16:36
浏览 32

str_replace无法在html代码中工作

i'm working with a form one of its fields is an RTF textarea (jWYSIWYG), that is autofilled with some database information at the load of the page, all that using Symfony framework. This RTF editor can add some html tags like <p>,<b>, etc.

The trouble starts when i try to know if the textarea has been modified before sending the form: what i get from the $request is that all the html tags are coded like &lt;p&gt;,&lt;b&gt;, etc. I tryed to replace that expressions with the < and > characters so i can compare it to the stored data.

$codes = array('&gt;','&lt;');
$chars = array('<'   ,'>' );
return str_replace($codes,$chars,$text);

but this function returns me the same array i pass as parameter of the str_replace function. What am I doing wrong? have anyone had the same problem?

  • 写回答

2条回答 默认 最新

  • doutiaosu2310 2011-12-19 16:41
    关注

    Try this function instead of str_replace: http://www.php.net/manual/en/function.htmlspecialchars-decode.php

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?