将html代码转换成字符串,如何进行转义? 比如将<form action="xxx.php">xxx<input type="text" name="xxx" /><input type="submit" value="xxx"/></form>转成一串字符串,可以传递到某页面执行该代码。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $str='<form action="xxx.php">xxx<input type="text" name="xxx" /><input type="submit" value="xxx"/></form>';echo urlencode($str); 我知道了 $str=html_entity_decode("<form action='xxx.php'>xxx<input type='text' name='xxx' /><input type='submit' value='xxx'/></form>"); 你得先编译,然后才能解码啊:$str = "<form action='xxx.php'>xxx<input type='text' name='xxx' /><input type='submit' value='xxx'/></form>";$str_encode = htmlentities($str);echo "str-->>encode".$str_encode."<br>";#源码#<form action='xxx.php'>xxx<input type='text' name='xxx' /><input type='submit' value='xxx'/></form>#将$str_encode传递后:$str_decode = html_entity_decode($str_encode);echo "str-->>decode".$str_decode."<br>";#源码#<form action='xxx.php'>xxx<input type='text' name='xxx' /><input type='submit' value='xxx'/> html_specialchars转成实体就不会被当做html标签了。 新人提问: 根据timestamp类型数据的早晚读取数据库内的数据 preg_match()是否支持array? php抓取站点的所有链接 一个疑难杂症,PHP高手门请进。解决立马给分 同一个页面两个select关联问题 大家在用php+mysql做blog的时候,是怎样生成rss(xml文件)的啊? PHP的地址彩蛋 求论坛源代码(php+mysql),指个路吧! 利用JoomFish进行多语言网站设计,需要什么前期工作。求大神指点 关于 phpmailer发送邮件的问题 有啥简便的方法
echo urlencode($str);
你得先编译,然后才能解码啊:
$str = "<form action='xxx.php'>xxx<input type='text' name='xxx' /><input type='submit' value='xxx'/></form>";
$str_encode = htmlentities($str);
echo "str-->>encode".$str_encode."<br>";
#源码
#<form action='xxx.php'>xxx<input type='text' name='xxx' /><input type='submit' value='xxx'/></form>
#将$str_encode传递后:
$str_decode = html_entity_decode($str_encode);
echo "str-->>decode".$str_decode."<br>";
#源码
#<form action='xxx.php'>xxx<input type='text' name='xxx' /><input type='submit' value='xxx'/>