如何编码单引号 [英] how to encode single quotes

查看:184
本文介绍了如何编码单引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我如何使用htmlentities •'为'在我的代码?
如何转义单引号



hows 撇号工作于 IE



< ($ row = pg_fetch_array($ result))
{
if($ row [3] ==)
{

$ vmobj_Array [$ i] = $ row [0]。***。$ row [1]。***。$ row [2];
}
else
{
$ vmobj_Array [$ i] = $ row [0]。'('。$ row [3]。')'。*** 。$行[1] *** $行[2];

}
$ i ++;
}


解决方案

一个答案,所以我也在这里发帖。



htmlentities($ str,ENT_QUOTES); 或者您可以随时接受其他人发布的答案。 htmlspecialchars($ str,ENT_QUOTES); 应该这样做,其中$ str应该被您想要转义的变量或字符串替换(例如, $行[0] )。如果你只是想添加它,你只需要添加它: print这是一个撇号&#039;;


I want to know how i use htmlentities •&#039; for ' in my code ? How to escape single quote

hows apostrophe work in IE

while($row = pg_fetch_array($result))
{
    if($row[3]=="")
    {

        $vmobj_Array[$i]=$row[0]."***".$row[1]."***".$row[2];
    }
    else
    {
        $vmobj_Array[$i]=$row[0].' ( '.$row[3].' )'."***".$row[1]."***".$row[2];

    }
    $i++;
}

解决方案

I think every question should have an answer, so I'm posting here as well. Feel free to accept the answer someone else posted there just now.

htmlentities($str, ENT_QUOTES); or htmlspecialchars($str, ENT_QUOTES); should do the trick where $str should be replaced by the variable or string you want to escape (e.g., $row[0]). If you just want to add it, all you need to do is add it: print "Here's an apostrophe &#039;";

这篇关于如何编码单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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