问题
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?
回答1:
Use ENT_XML1
instead of ENT_HTML401
. SVG uses XML:
htmlentities($instring,ENT_QUOTES|ENT_XML1,"UTF-8",false)
来源:https://stackoverflow.com/questions/59474432/character-entities-in-php-and-svg