How do I replace ampersands in a url from & > &
I use some rss feeds wit开发者_运维百科ch has URL containing &
should I use
$link = str_replace('&', '&', $link);
or there are other options?
Use htmlspecialchars
. It replaces not just &
but also "
, <
, >
, and '
(only if quote_style parameter is set to ENT_QUOTES
) that all need to be replaced with appropriate character references.
精彩评论