最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php正则之删除或转换字符串中url地址
时间:2022-11-14 23:01:07 编辑:袖梨 来源:一聚教程网
删除url
| 代码如下 | 复制代码 |
| $string = preg_replace('/b(https?|ftp|file)://[-A-Z0-9+&@#/%?=~_|$!:,.;]*[A-Z0-9+&@#/%=~_|$]/i', '', $string); | |
将url转换成链接
| 代码如下 | 复制代码 |
| $url = "Jean-Baptiste Jung (http://www.111**co*m.net)"; $url = preg_replace("#http://**([A-*z0-9./-]+)#", 'http://www.*11**1com.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); |
|