【发布时间】:2016-11-10 18:10:49
【问题描述】:
所以我有类似的日志文件
03.02.14 11:16:55 1671 303 00:00:37 6599990 2
03.02.14 11:19:03 1671 303 00:00:37 6599990 2
04.02.14 09:34:06 1670 303 00:03 00:00:05 06865500 1
读取它并将其放入页面的代码
echo "<tr>";
foreach (preg_split("/ +/", $line, -1, PREG_SPLIT_NO_EMPTY) as $value) {
$lineList[$lineNum][$wordNum] = $value;
$startTS = date_create_from_format('j.m.y', $_REQUEST['datefrom']);
$endTS = date_create_from_format('j.m.y', $_REQUEST['dateto']);
$checkTS = date_create_from_format('j.m.y', $lineList[0][0]);
if (($checkTS >= $startTS) && ($checkTS <= $endTS)){
echo "<td class='empty'>$value</td>";
$wordNum++;
}
} echo "</tr>";
因此,您可以看到日志文件中有多个空格,但它无法识别它们并且不会写入空白单元格。 result from page
【问题讨论】:
标签: php html html-table