Php 在页面中获取和打印时处理单引号和双引号
对不起,马的问题出了一点问题,alis有价值,比如alias=“Sri Kumaran儿童之家-CBSENothing与知识一样纯洁神圣。”但正如我给出的url所示。当我将鼠标悬停在链接上时,它只显示alias=Sri Kumaran Children。如何解决这个问题Php 在页面中获取和打印时处理单引号和双引号,php,Php,对不起,马的问题出了一点问题,alis有价值,比如alias=“Sri Kumaran儿童之家-CBSENothing与知识一样纯洁神圣。”但正如我给出的url所示。当我将鼠标悬停在链接上时,它只显示alias=Sri Kumaran Children。如何解决这个问题 $myresult .= "<a href='Schools/{$alias}'><img src='/school/schoolpicdisplay.php?p1={$brand}&p2={$mod
$myresult .= "<a href='Schools/{$alias}'><img src='/school/schoolpicdisplay.php?p1={$brand}&p2={$model}' width=\"50\" height=\"80\"></img></a>";
$myresult.=”;
如果你知道会有一个单引号,为什么不先用双引号呢
"...<img src=\"/school/schoolpicdisplay.php?p1={$brand}&p2={$model}\"..."
为什么要将字段名存储为字段值的一部分?只需将“Sri Kumaran Children's Home”存储在模型字段中,并在PHP中构建GET字符串。您的宽度和高度属性值也可以用单引号括起来,以使其更加一致。抱歉,ma问题出了点问题alis的值类似于别名=“Sri Kumaran儿童之家-CBSENothing与知识一样纯洁神圣。”但正如我给出的url所示。当我将鼠标悬停在链接上时,它只显示alias=Sri Kumaran Children。如何解决这个问题problem@pradeep:(1)如果问题出错,请编辑它请参阅update.okie rawurlencode有效。没有其他方法来解决这个问题吗?@pradeep:还有很多其他转义函数,但是
urlencode
或rawurlencode
最适合您的情况。okie。因此,我的php语句没有问题。我不得不使用语句中的引号来处理这个问题问题
$encoded_model = rawurlencode($model);
$encoded_alias = rawurlencode($alias);
$myresult .= "<a href='Schools/{$encoded_alias}'>...p1={$encoded_brand}&p2={$encoded_model}...";