Some Wordpress plugins (one is MapP开发者_如何学Pythonress which uses Google Maps) use ampersands in their links but do not convert them into the correct HTML character entity:
&
This invalidates the markup and is very frustrating!
Is there any way to convert the &
to &
?
I've searched for a long time and found no solution, but have read a lot of interesting articles on the topic!
I think you're looking for htmlentities
: http://php.net/manual/en/function.htmlentities.php
<?php
$str = "A 'quote' is <b>bold</b>";
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str);
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str, ENT_QUOTES);
?>
I'd write an email to him and ask him to use htmlentities
in his plugin. Even better, make the changes yourself, then email him a patch.
精彩评论