我需要你的幫助。我想轉這個:sometext sometext http://www.somedomain.com/index.html sometext sometext變成:sometext sometext <a href="http://somedoamai.com/index.html">www.somedomain.com/index.html</a> sometext sometext我已經通過使用此正則表達式來管理它:preg_replace("#((http|https|ftp)://(\S*?\.\S*?))(\s|\;|\)|\]|\[|\{|\}|,|\"|'|:|\<|$|\.\s)#ie", "'<a href=\"$1\" target=\"_blank\">$1</a>$4'", $text);問題在于它也在替換imgURL,例如:sometext sometext <img src="http//domain.com/image.jpg"> sometext sometext變成:sometext sometext <img src="<a href="http//domain.com/image.jpg">domain.com/image.jpg</a>"> sometext sometext請幫忙。
- 3 回答
- 0 關注
- 974 瀏覽
相關問題推薦
添加回答
舉報
0/150
提交
取消