[PHP] PHP自动加a标签 将网址字符串转换成超级链接 →→→→→进入此内容的聊天室

来自 , 2020-06-20, 写在 PHP, 查看 138 次.
URL http://www.code666.cn/view/687fd5c7
  1. function makeClickableLinks($text) {
  2.         $text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?&//=]+)',
  3.         '<a href="\1">\1</a>', $text);
  4.         $text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?&//=]+)',
  5.         '\1<a href="http://\2">\2</a>', $text);
  6.         $text = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})',
  7.         '<a href="mailto:\1">\1</a>', $text);  
  8.          
  9.         return $text;
  10. }
  11.  

回复 "PHP自动加a标签 将网址字符串转换成超级链接"

这儿你可以回复上面这条便签

captcha