Say I have a forum thread and I want to make all mentioned URLs as clickable links. How can I accomplish this in Yii?
Thanks.
This is copied straight from this stackoverflow question
$text = preg_replace("
#((http|https|ftp)://(\S*?\.\S*?))(\s|\;|\)|\]|\[|\{|\}|,|\"|'|:|\<|$|\.\s)#ie",
"'<a href=\"$1\" target=\"_blank\">$3</a>$4'",
$text
);
Did you look into CHtmlPurifier ? see: Linkify and http://htmlpurifier.org/demo.php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.