PHP用dom返回html表的第n行 [英] PHP return the nth row of a html table with dom

查看:90
本文介绍了PHP用dom返回html表的第n行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用simplehtmldom( http://simplehtmldom.sourceforge.net/ )打印出表的第n行。目前没有任何事情发生,还有什么我需要做的吗?

I'm trying to use the simplehtmldom (http://simplehtmldom.sourceforge.net/) to print out the nth row of a table. Currently nothing happens, is there anything else I need to do?

<?php
include 'simple_html_dom.php';
$html = file_get_html('http://www.masjid-umar.org/downloads/timetable_apr.htm');
$ret = $html->find('tr', 9);
echo $ret;
?>


推荐答案

0是第一行,所以8将是第九:

0 is the first row, so 8 would be the ninth:

$ret = $html->find('tr', 8);

这篇关于PHP用dom返回html表的第n行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆