PHP 和 SVG 中的字符实体 [英] Character entities in PHP and SVG
本文介绍了PHP 和 SVG 中的字符实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于我的 HTML 内容,我一直使用 htmlentities($instring,ENT_QUOTES|ENT_HTML401,"UTF-8",false)
用 HTML 实体替换某些字符.不过我也是服务SVG内容的,有些实体看不懂,比如…
.SVG 中的字符实体是否有特殊的 PHP 函数?
For my HTML content I have been using htmlentities($instring,ENT_QUOTES|ENT_HTML401,"UTF-8",false)
to replace certain characters with HTML entities. However, I also serve SVG content, and some of the entities are not understood, such as …
. Is there a special PHP function for character entities in SVG?
推荐答案
使用 ENT_XML1
而不是 ENT_HTML401
.SVG 使用 XML:
Use ENT_XML1
instead of ENT_HTML401
. SVG uses XML:
htmlentities($instring,ENT_QUOTES|ENT_XML1,"UTF-8",false)
这篇关于PHP 和 SVG 中的字符实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文