php网址转换为超链接方法
pphp网址转换为超链接方法br / a href=http://hi.baidu.com/9958ing/bloghttp://hi.baidu.com/9958ing/blog/a/p
php网址转换为超链接方法
http://hi.baidu.com/9958ing/blog
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;
}
- 上一篇:PHP1分钟脚本-你们都是2货
- 下一篇:大家认为以下代码是输出Y还是输出N
精彩图集
精彩文章






