【发布时间】:2016-11-12 18:38:49
【问题描述】:
我在谷歌上搜索了几个小时,但没有找到关于我的问题的任何信息。
$elements[] = array('time1' => $time1, 'time2' => $time2, 'string1' => $string1, 'string2' => $string2, 'string3' => $string3, 'string4' => $string4);
我得到了数组 $elements,在那里我用你从 Internet 页面的 HTML 表中看到的代码编写了行。但是我找不到路,怎么能按时间过滤。
例如,我想使用 3 小时的时间间隔,并在接下来的 3 小时内从数组元素中获取。
我尝试使用
while( $tmnw = date("H:i", strtotime('+3 hours')); $tmnw < $elements['time2'] ) {
echo information from array;
}
但他抛出错误:
[12-Nov-2016 20:35:03] PHP Notice: Trying to get property of non-object in filtering.php on line 15
[12-Nov-2016 20:35:03] PHP Notice: Undefined index: time2 in filtering.php on line 41
使用 simple_dom 将时间存储在数组中:
$time1= date( "H:i", strtotime( $row->find('td',0)->plaintext ) );
$time2= date( "H:i", strtotime( $row->find('td',1)->plaintext ) );
【问题讨论】: