复制代码 代码如下:
function showtext($text){ $search = array('|(http://[^ ]+)|', '|(https://[^ ]+)|', '|(www.[^ ]+)|'); $replace = array('<a href="$1" target="_blank">$1</a>', '<a href="$1" target="_blank">$1</a>', '<a href="http://$1" target="_blank">$1</a>'); $text = preg_replace($search, $replace, $text); return $text; }
查看更多关于php中将网址转换为超链接的函数,需要的朋友可的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did7381