时时商务社区
标题:
php中将网址转换为超链接的函数
[打印本页]
作者:
网络通达
时间:
2018-2-14 08:32
[U]复制代码[/U] 代码如下:
function showtext($text){
$search = array('|(http://[^ ]+)|', '|(https://[^ ]+)|', '|(www.[^ ]+)|');
$replace = array('
$1
', '
$1
', '
$1
');
$text = preg_replace($search, $replace, $text);
return $text;
}
您可能感兴趣的文章:
php 正则 过滤html 的超链接
PHP 超链接 抓取实现代码
php 自写函数代码 获取关键字 去超链接
用PHP将网址字符串转换成超链接(网址或email)
PHP使用正则表达式清除超链接文本
php结合js实现点击超链接执行删除确认操作
php获取超链接文本内容的正则表达式(五种方法)
php批量删除超链接的实现方法
欢迎光临 时时商务社区 (http://bbs.4435.cn/)
Powered by Discuz! X3.2