1

我试图在打开购物车网站的表单中转义一些 HTML - 它是带有会话数据的自定义编码,这让我很失望。目前我有:

<input type="text" value="<?php echo $this->session->data['persline_2']; ?>" name="persline_2" id="persline_2" class="keyboardInput" style="width:200px" maxlength="30" />

我试图使用:

<input type="text" value="<?php echo htmlentities$this->session->data['persline_2']; ?>" name="persline_2" id="persline_2" class="keyboardInput" style="width:200px" maxlength="30" />

但这并没有奏效。我认为htmlentities应该在变量之前开始。

这是在他们的 MVC 下使用 PHP 的开放式购物车仅供参考。

4

1 回答 1

2

尝试:<?php echo htmlentities($this->session->data['persline_2']); ?>注意括号()

于 2012-05-03T04:07:48.893 回答