function AddLink2Text($str) { $str = preg_replace("#(http://[0-9a-z._/?=&;]+)#i","<a href=\"\1\"target=\"_blank\">\1</a>", $str); $str = preg_replace("#([0-9a-z._]+@[0-9a-z._?=]+)#i","<ahref=\"mailto:\1\">\1</a>", $str); return $str; }
目前用過覺得功能超強大的,可以解決如果一半有連結一半沒有連結問題
Linkify
https://github.com/SoapBox/jQuery-linkify
其他資料參考
http://reader.roodo.com/andre/archives/421193.html
Linkify
https://github.com/SoapBox/jQuery-linkify
其他資料參考
http://reader.roodo.com/andre/archives/421193.html
沒有留言:
張貼留言