说我有
<a href="www.myurl/point.html" class="l" style="color:#436DBA;" onclick="return rs(this,'8 Stunning Linguistic Miracles of The Holy Quran | Kinetic Typography 144p (Video Only).mp4');">» Download MP4 «</a> - <b>144p (Video Only)</b> - <span> 19.1</span> MB<br />
像这样的html页面我想用简单的dom php解析器解析它,我想下载mp4 114p 19.1作为输出,而我尝试此代码
foreach($displaybody->find('a ') as $element) {
// echo $element->innertext . '<br/>';
它还给我下载mp4我怎么解析剩余值下载mp4 114p 19.1请帮帮我
答案 0 :(得分:0)
您不能再使用<a>
标记了,因为您尝试访问的某些文字不再包含在其中,定位文档本身然后使用{{1 }}:
->plaintext
以下是使用xpath访问每行$html = <<<EOT
<a href="www.myurl/point.html" class="l" style="color:#436DBA;" onclick="return rs(this,'8 Stunning Linguistic Miracles of The Holy Quran | Kinetic Typography 144p (Video Only).mp4');">» Download MP4 «</a> - <b>144p (Video Only)</b> - <span> 19.1</span> MB<br />
EOT;
$displaybody = str_get_html($html);
echo $displaybody->plaintext;
的另一种方法:
DOMDocument