开发者

Displaying & instead &

I have the following string saved in a database: "cocotte & kekette".

When I query it and display in my web page with PHP, the开发者_Go百科 string "cocotte & kekette" is displayed.

Can someone tell me how to fix this?


Try either

html_entity_decode($string);

Or

mb_convert_encoding($string, "HTML-ENTITIES", "UTF-8");


That means you probably saved "cocotte & kekette" in the database to begin with. If not, you're double encoding your string.

The right path would be to save the data unencoded in the database. That not being possible, see the $double_encode argument (set it to FALSE) in htmlspecialchars.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜