小编lop*_*plo的帖子

简单的html dom解析器表到数组

我正在尝试从这里解析到达表[1]并放入一个数组,以便能够格式化它并将其放入表中.

我在这里和那里做了一些研究,我从其他问题得到了一些代码,但我不能像我想的那样使数组和表格看起来像.

有人可以帮帮我吗?

<?php
require('simple_html_dom.php');
$html = file_get_html('http://flightplan.romatsa.ro/init/fpl/flightslr/LRCL/');
$table = $html->find('table', 3);
foreach($table->find('tr') as $row) {
// initialize array to store the cell data from each row
$rowData = array();
foreach($row->find('td') as $cell) {
// push the cell's text to the array
$rowData[] = $cell->innertext;
}
echo "<table>";
echo "<td>";
echo $rowData[0]. " ";
echo "</td>";
echo "<td>";
echo $rowData[1]. " ";
echo "</td>";
echo "<td>";
echo $rowData[2]. " ";
echo "</td>";
echo "<td>";
echo $rowData[3]. " "; …
Run Code Online (Sandbox Code Playgroud)

html php arrays dom html-table

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

arrays ×1

dom ×1

html ×1

html-table ×1

php ×1