how to convert new line and html code in htmlspecialchars in php

大憨熊 提交于 2019-12-30 16:06:10

问题


here is my string

hello


world



<textarea>hello world</textarea>

how can I convert this string

hello

&nbsp;

world

&nbsp;

&nbsp;

&lt;textarea&gt;hello world&lt;/textarea&gt;

in php. Any one help please... I am try htmlspecialchars(); function but that doesn't work perfect.


回答1:


please read more on php ..Maybe this can help you https://www.w3schools.com/pHp/default.asp

<?php

    echo "hello";
    echo "</br>";
    echo "world";
    echo "</br>";
    echo "</br>";
    echo "<input type = 'textare' value = 'hello world'>";
    ?>


来源:https://stackoverflow.com/questions/45114200/how-to-convert-new-line-and-html-code-in-htmlspecialchars-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!