【发布时间】:2014-07-07 11:41:27
【问题描述】:
尝试使用 echo 让 html 代码正常工作,
这可以作为 html:
<input type="text" name="ordernum" value="<?= isset($_POST['ordernum']) ? htmlspecialchars($_POST['ordernum']) : '' ?>" />
但是当我用反斜杠转义值时(我尝试了几十种组合并且在 stackoverflow 上阅读了很多内容,但仍然无法修复它)我得到了意外的 T_STRING 错误。
echo ' <input type="text" name="ordernum" value=\'= isset($_POST['ordernum']) ? htmlspecialchars($_POST['ordernum']) : '' \' />';
【问题讨论】:
-
你不能在字符串文字的中间写任意的 PHP 代码。
标签: php forms input echo backslash