php 中 传数据
< ?xml versi encoding="ISO-8859-1"?>
<note>
&lt;heading&gt;Reminder&lt;/heading&gt;
&lt;body&gt;Don't forget the meeting!&lt;/body&gt;
</note>
到前端 用textarea 显示
再从前端post 数据回来
使用echo $this->input->post ('content');
为何值为:
&lt ?xml versi encoding="ISO-8859-1"?&gt;
<note>
&lt;heading&gt;Reminder&lt;/heading&gt;
&lt;body&gt;Don't forget the meeting!&lt;/body&gt;
</note>第一个 &lt;   post回来为什么变成了 &lt    ?html 转义字符

解决方案 »

  1.   

    test.php<html>
    <body>
    <?php
       $str='
       &lt; ?xml versi encoding="ISO-8859-1"?&gt;
    <note>
    &lt;heading&gt;Reminder&lt;/heading&gt;
    &lt;body&gt;Don\'t forget the meeting!&lt;/body&gt;
    </note>'
    ;var_dump($_POST);
    ?>
    <form method="post">
    <textarea name='test'> <?php echo $str  ;?> </textarea>
    <input  type="submit" />
    </form>
    </body></html>
    没有你说的情况
      

  2.   

    $str=<<<EOF
    &lt; ?xml versi encoding="ISO-8859-1"?&gt;
    <note>
    &lt;heading&gt;Reminder&lt;/heading&gt;
    &lt;body&gt;Don't forget the meeting!&lt;/body&gt;
    </note>
    EOF;echo htmlspecialchars_decode($str);