有这么一段HTML,比较不规则的,如果要提取其中的链接地址和链接名称,怎么弄?
|
以下为引用的内容: //HTML $str = '歌曲列表 中文金曲榜 |
• 轻音乐 | ';
|
以下为引用的内容: $pat = '/(.*?)/i'; preg_match_all($pat, $str, $m); |
|
以下为引用的内容: print_r($m[2]); print_r($m[4]); |
|
以下为引用的内容: for($i=0;$i } |
|
以下为引用的内容: Array ( [0] => http://list.mp3.baidu.com/song/A.htm?top8 [1] => http://list.mp3.baidu.com/list/bangping.html [2] => qingyinyue.html?top19 ) Array ( [0] => 歌曲列表 [1] => 中文金曲榜 [2] => 轻音乐 ) |
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号