将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标签了。 留言内容遇到7-11位纯数字,自动隐藏掉其中2位,代码应该怎么写? 求一组参数的写法 积分系统设计?? dotproject 任务权限处的控制? phpMyAdmin无反应 php://input 接收文件失败,图片变的非常小,无法打开 急!!请问php中是否可以接收来自c程序往消息队列中放的消息 file函数的问题.解决问题后另赠100分. 再问session,我想这不是重复的问题 对面的高手看过来 关于 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'/>