在字符串中使用htmlentities [英] Using htmlentities in a string

查看:68
本文介绍了在字符串中使用htmlentities的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我应该在所有表单文本输入字段中使用htmlentities,但这不起作用:

I know I should be using htmlentities for all my form text input fields but this doesn't work:

<?php
echo "<tr>
        <td align=\"right\">".Telephone." :</td>    
        <td><input type=\"text\" name=\"telephone\" size=\"27\"
            value=\"htmlentities($row[telephone])\"> Inc. dialing codes
        </td>    
</tr>";
?>

它只是以形式将输入值显示为"htmlentities(0123456789)"?我做错了什么吗?

It simply shows the input value as "htmlentities(0123456789)" in the form? What have I done wrong please?

推荐答案

尝试使用

value=\"" . htmlentities($row[telephone]) . "\"

有.当前,您的字符串仅包含htmlentities字符串,并将变量拼接到其中.您需要取出字符串,调用函数并将其结果放在适当的位置,如上所述.

there. Currently, your string simply contains the htmlentities string and splices the variable in. You need to get out the string, call the function and put it's result in place, as above.

这篇关于在字符串中使用htmlentities的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆