开发者

variable in textarea template code closing textarea tag

开发者 https://www.devze.com 2023-04-02 20:00 出处:网络
I have in my control panel ( HTML template editor ) <? $textarea = \'<textarea>\'; $textarea .= $template_code;

I have in my control panel ( HTML template editor )

<?
$textarea = '<textarea>';
$textarea .= $template_code;
$textarea .= '</textarea>';
echo $textarea;
?>

The variable $template_code contains html, including </textarea>

开发者_如何学JAVA
for example -> $template_code = '</textarea> ......';

This means the variable will close my textarea and other code will be outside my real textarea!!

How i can avoid this?


use htmlentities to escape the special characters.

echo '<textarea>'.htmlentities($template_code).'</textarea>';
0

精彩评论

暂无评论...
验证码 换一张
取 消