删除url
代码如下 | 复制代码 |
$string = preg_replace('/b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|$!:,.;]*[A-Z0-9+&@#/%=~_|$]/i', '', $string); |
将url转换成链接
代码如下 | 复制代码 |
$url = "Jean-Baptiste Jung (http://www.111com.net)"; $url = preg_replace("#http://([A-z0-9./-]+)#", 'http://www.111com.net $1" style="font-size: 12px; vertical-align: baseline; background-color: transparent; margin: 0px; padding: 0px; color: #3777af; text-decoration: none; font-weight: bold">$0', $url); |