正则表达式提取:PHP正则表达式提取超链接及其标题来源: 发布时间:星期一, 2009年1月12日 浏览:152次 评论:0
有这么
![]() ![]() ![]() ![]() ![]() ![]() //HTML $str = '<a id="top8" href="http://list.MP3.baidu.com/song/A.htm?top8" 利用正则表达式是最简单 ![]() ![]() ![]() ![]() ![]() ![]() ![]() $pat = '/<a(.*?)href="(.*?)"(.*?)>(.*?)</a>/i'; 输出思路方法: pr 或者: for($i=0;$i<count($m[2]) ;$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] => 轻音乐 ) 于是 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 0
相关文章读者评论发表评论 |