开发者

htmlspecialchars text

I have created an article comment for my user to post comment. I also have a function that automatically creates link if url is detected in the message. However now I am puzzled as to how do I convert text using htmlspecialchars and at the same time creates the link together without "authoring the URL"?

For example:

$message = 'This is a message with a url http://www.stackoverflow.com?id=1&get=1';
makeLink( htmlspecialchars( $message ) )

// I will get "This is a message with a url http://www.stackoverflow.com?id=1&get=开发者_StackOverflow中文版1" 
// Notice the ampersand became & How do I prevent this?


Either fold it back to regular text using html_entity_decode() or use RegEx or regular text replacement to make & turn back to &.


Use html_entity_decode($a)

i think your issue will be solved by use of this

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜