我目前正在开发kruti dev 010字体我的字符串包含类似的html编号
& #39; ,& amp;,& quot;
我想把这个词转换成'&">
<?php
$string="my string with '";
echo html_entity_decode($string); //not working
?>
我想要像一样的输出
my string with '
当你第一次尝试使用报价时,报价总是一个很快的障碍。诀窍是将ENT_QUOTES添加到函数中。请参阅htmlspecialchars_decode
<?php
$string="my string with '";
echo htmlspecialchars_decode( "my string with '" , ENT_QUOTES );
?>
注意:被解码的字符末尾的分号不是必需的,但总体上被认为是良好的姿势。上面省略了它,以便更好地匹配原始代码。
尝试在PHP脚本开始时调用header('Content-Type: text/html; charset=utf-8');
,或将AddDefaultCharset UTF-8
添加到.htaccess
文件中。
<?php
$string="my string with '";
echo html_entity_decode($string); //not working
?>
您忘记了分号
$string="my string with '";