php 正则表达式获取ul标签下的a标签,div标签和span标签的字段。还有a标签中href的链接 20
<ulclass="r"><li><ahref="./28190285/?i=4&from=cancer"rel="chapter"ref="linksrc=do...
<ul class="r"><li>
<a href="./28190285/?i=4&from=cancer" rel="chapter" ref="linksrc=docsum_title">The issues regarding postoperative adjuvant therapy and prognostic risk factors for patients with stage I-II cervical cancer: A review.</a>
<div class="pub_type">Review article</div>
<span class="aux light_narrow_text">Takekuma M, et al.
J Obstet Gynaecol Res. 2017</span>
</li> 展开
<a href="./28190285/?i=4&from=cancer" rel="chapter" ref="linksrc=docsum_title">The issues regarding postoperative adjuvant therapy and prognostic risk factors for patients with stage I-II cervical cancer: A review.</a>
<div class="pub_type">Review article</div>
<span class="aux light_narrow_text">Takekuma M, et al.
J Obstet Gynaecol Res. 2017</span>
</li> 展开
2个回答
2017-02-13
展开全部
$Html = '<ul class="r"><li>
<a href="./28190285/?i=4&from=cancer" rel="chapter" ref="linksrc=docsum_title">The issues regarding postoperative adjuvant therapy and prognostic risk factors for patients with stage I-II cervical cancer: A review.</a>
<div class="pub_type">Review article</div>
<span class="aux light_narrow_text">Takekuma M, et al.
J Obstet Gynaecol Res. 2017</span>
</li>';
$Html = preg_replace('/\s{2,}/', '', $Html);
preg_match_all('/<a[^>]*href\s?=\s?[\'"]([^\'"]*)[^>]*>([^<]*)<\/a><div[^>]*>([^<]*)<\/div><span[^>]*>([^<]*)<\/span>/is', $Html, $Arr);
print_r( $Arr );
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询