【发布时间】:2009-02-05 21:41:01
【问题描述】:
为什么 htmlspecialchars() 不能在每次提交表单后连续编码字符?看看下面的例子:
<?php $_POST['txt'] = htmlspecialchars($_POST['txt']); ?>
<form method="post">
<input name="txt" value="<?=$_POST['txt'] ?>" />
<input type="submit" name="save" value="test" />
</form>
你可以在http://verticalcms.com/htmlspecialchars.php看到它。
现在执行以下操作
1) Type & into the text field
2) Hit the test button once
3) When the page completes post back, hit the test button again
4) When the page completes post back, view the page source code
在输入框中,值为&
我期待 & amp;功放;
为什么不是&放大器; ???
【问题讨论】:
标签: php htmlspecialchars