最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php url 正则表达式用法
时间:2022-11-14 23:01:27 编辑:袖梨 来源:一聚教程网
下面二款php教程 正则来表达式来处理url匹配的代码,希望对你有点帮助。
$url = 'http://www.bai***du.com/zongzi/oo.html';
$n = preg_match_all("/http:[/]{2}[a-z]+[.]{1}[a-zd-]+[.]{1}[a-zd]*[/]*[A-Za-zd]*[/]*[A-Za-zd]*[.]*html/",$url,$array);
var_dump($array);
?>
例子
$url = 'http://www.te***st.com/icons/favicon-54.ico, http://www.b***aidu.com/bb, http://www.1**1*1com.net, http://img.*b*aid*u.com/logo.ico';
$pattern = "|http://[^,*]+?.*ico*,?|U";
preg_match_all($pattern, $url, $matches);
print_r($matches);
输出结果:
Array
(
[0] => Array
(
[0] => http://www.*te**st.com/icons/favicon-54.ico
[1] => http://img.ba*i**du.com/logo.ico
))
相关文章
- 微知库学生版app如何开启推送通知 07-10
- 如何查询中通快递快件单号 07-10
- 三口实训3ds是什么 07-10
- 腾讯视频官方在线观看正版清晰度高在哪看 07-10
- CXB主轴动平衡校正方法是什么 07-10
- 微信朋友圈无法发布怎么办 07-10