Home  >  Article  >  Backend Development  >  如何用正则获取到这个href

如何用正则获取到这个href

WBOY
WBOYOriginal
2016-06-13 11:56:481040browse

怎么用正则获取到这个href?

本帖最后由 u014203582 于 2014-05-07 16:54:11 编辑

我知道怎么正则出每个标题
preg_match_all('|black" title="(.*?)"|i',$info,$m);


<span id="dnn_ctr19997_ContentPane" class="DNNAlignleft"><br /><span class="Normal"><br /><div   style="max-width:90%"><br /><div id="dnn_ctr19997_ModuleContent"><br /><span id="dnn_ctr19997_ArticleList_ctl00_lblMessage"></span><br /><table id="dnn_ctr19997_ArticleList_ctl00_lstArticles" class="ArticleList" border="0" cellspacing="0" cellpadding="0" style="width:100%;border-collapse:collapse;"><br /><tbody><br /><tr><br /><td><br /><table width="100%"><br /><tbody><br /><tr><br /><td><br /><a id="dnn_ctr19997_ArticleList_ctl00_lstArticles_ctl00_titleLink" class="viewsblack" href="/Default.aspx?tabid=9597&ctl=Details&mid=19997&ItemID=128217&SkinSrc=[L]Skins/shangshida1_5/shangshida1_5&language=zh-CN" title="“甲子人文底蕴?美丽师大校园”摄影视频作品征集活动通知">“甲子人文底蕴?美丽师大校园”摄影视频作品征集活动...</a><br /></td><br /><td width="136px" valign="top" align="left"><br /></tr><br /></tbody><br /></table><br /><div><br /></td><br /></tr>

------解决方案--------------------
'Url' => "http://www.shnu.edu.cn".$n[1][$i]
改成
'Url' => "http://www.shnu.edu.cn". str_replace('amp;', '', $n[1][$i])
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn