【问题标题】:php does not work correctly with textarea tag and displays the rest of the html tags when i use textarea [duplicate]当我使用 textarea 标签时,php 无法正常使用 textarea 标签并显示其余的 html 标签 [重复]
【发布时间】:2015-04-28 03:38:39
【问题描述】:

所以我有这个代码:

<?php
    echo "<textarea style='width:500px; height:600px'>";

    while($extract = $result->fetch_array())
    {
        echo "<span class='usr'>" . $extract['usr'] . "</span>: <span class='msg'>" . $extract['msg'] . "</span><br/>";
    }

    echo "</textarea>";

    $result->close();
    $conexion->close();
?>

文本区域的输出给了我这个:

&lt;span class='usr'&gt;dsdsds&lt;/span&gt;: &lt;span class='msg'&gt;aaaaa&lt;/span&gt;&lt;br/&gt;

【问题讨论】:

    标签: php html css


    【解决方案1】:

    您不能在&lt;textarea&gt; 中使用 HTML 代码来呈现 HTML。

    Rendering HTML inside textarea

    【讨论】:

    • 还有其他方法吗?没有 textarea 标签也能正常工作。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-19
    • 1970-01-01
    • 2023-02-01
    相关资源
    最近更新 更多