一个修改过的自动转换url和mail的函数,功能强大
可以转换以http和ftp开头的
还有mail的
还有www开头的
很好的噢
<?
function enable_urls($str){
$str ereg_replace("(www.[a-zA-Z0-9@:%_.~#-\?&]+)"" <a href=\"LINKttp://\\1\" target=\"_blank\">\\1</a>"$str);// 自动转化www开头的链接
$str ereg_replace("(((f|ht){1}tp://)[a-zA-Z0-9@:%_.~#-\?&]+)""<a href=\"\\1\" target=\"_blank\">\\1</a>"$str);//转化http://开头和ftp://开头的链接
$str=str_replace('LINKttp://','http://',$str);
$str ereg_replace("([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})","<a href=\"mailto:\\1\">\\1</a>"$str);// 转化邮件地址
return $str;
}
?>