【发布时间】:2021-03-08 18:19:53
【问题描述】:
我有这段 HTML 代码:
<div class='ipsDataItem_main'>
<h4 class='ipsDataItem_title ipsContained_container'>
<span>
<a href='https://www.' title='Aller au premier message non lu' data-ipsTooltip>
<span class='ipsItemStatus'><i class="fa fa-circle"></i></span>
</a>
</span>
<span class='ipsType_break ipsContained'>
<a href='https://www../topic/81272-une-a' class='' title='Une affaire de ' data-ipsHover data-ipsHover-target='https://www/?preview=1' data-ipsHover-timeout='1.5'>
<span>
Une affa.
</span>
</a>
</span>
</h4>
<div class='ipsDataItem_meta ipsType_reset ipsType_light ipsType_blendLinks'>
<span>
Par
<a href='https://www../profile/5825-crobler/' data-ipsHover data-ipsHover-target='https://www../profile/5825-cr' title="Aller sur le profil " class="ipsType_break"><span style='color:#0099cc'>Crobler</span></a>,
</span><time datetime='2021-03-05T1:5:09Z' title='05/01/2021 20:59 ' data-short='2 j'>Vendredi à 20:59</time>
dans <a href="https://www../?fo">WEB-DL 2160</a>
<ul class='ipsTags ipsTags_inline ipsList_inline '>
<li >
<a href="https://www../tags/une_ails/" class='ipsTag' title="" rel="tag"><span></span></a>
</li>
</ul>
</div>
</div>
我想提取时间标签“05/01/2021 20:59”的标题。我尝试了以下代码:
foreach($html->find('div[class=ipsDataItem_main] a') as $f) {
echo $f->title;
}
我有所有标题,但没有我想要的。请问我该怎么做? 我怎么能只选择我想要的“标题”?例如“ipsType_break ipsContained”类中的标题?
提前谢谢你。
【问题讨论】:
-
$html->find('.ipsDataItem_meta time')是否提供正确的项目?
标签: php parsing simple-html-dom