比如将<form action="xxx.php">xxx<input type="text" name="xxx" /><input type="submit" value="xxx"/></form>转成一串字符串,可以传递到某页面执行该代码。

解决方案 »

  1.   

    $str='<form action="xxx.php">xxx<input type="text" name="xxx" /><input type="submit" value="xxx"/></form>';
    echo urlencode($str);
      

  2.   

    我知道了 $str=html_entity_decode("<form action='xxx.php'>xxx<input type='text' name='xxx' /><input type='submit' value='xxx'/></form>");
      

  3.   


    你得先编译,然后才能解码啊:
    $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>";
    #源码
    #&lt;form action='xxx.php'&gt;xxx&lt;input type='text' name='xxx' /&gt;&lt;input type='submit' value='xxx'/&gt;&lt;/form&gt;
    #将$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'/>
      

  4.   

    html_specialchars转成实体就不会被当做html标签了。