php字符串转换为html
我有一个字符串 <div id="myid">
...</div>
我如何将其更改为
...
我已经尝试了一些方法,但没有任何帮助?
更新
function get_page(){
$file = 'file.php';
$str = file_get_contents($file);
$str = html_entity_decode($str);
return $str;
}
$output = get_page();
echo $output;//don't work
修复
function get_page(){
$file = 'file.php';
$str = file_get_contents($file);
return $str;
}
$output = get_page();
echo html_entity_decode($output);//works
I have a string <div id="myid">
...</div>
How would I change this into<div id="myid">
...</div>
I have tried a few things but no luck any help?
Update
function get_page(){
$file = 'file.php';
$str = file_get_contents($file);
$str = html_entity_decode($str);
return $str;
}
$output = get_page();
echo $output;//don't work
FIX
function get_page(){
$file = 'file.php';
$str = file_get_contents($file);
return $str;
}
$output = get_page();
echo html_entity_decode($output);//works
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
其函数是
htmlspecialchars_decode()
。请注意,对于解码引号的函数,您需要指定
$quote_style
参数。The function for that is
htmlspecialchars_decode()
.Note that for the function to decode quotes, you need to specify the
$quote_style
parameter.html_entity_decode
是您所需要的: http: //www.php.net/manual/en/function.html-entity-decode.phphtml_entity_decode
is what you need: http://www.php.net/manual/en/function.html-entity-decode.php用这个更好...
use this it's better ...