【发布时间】:2019-10-12 12:06:16
【问题描述】:
我应该找到今天的时间戳,如果计数超过 3,则返回 false,如果不返回 true
查询:
while( $record = $result->fetchAssoc() ) {
$items[] = $record;
}
输出:
Array
(
[0] => Array
(
[timestamp] => 1570877769
)
[1] => Array
(
[timestamp] => 1570877783
)
[2] => Array
(
[timestamp] => 1510877794
)
)
Foreach:
foreach ($items as $Newarrays) {
}
使用 foreach 循环后查看:
Array
(
[timestamp] => 1570877769
)
Array
(
[timestamp] => 1570877783
)
Array
(
[timestamp] => 1570877794
)
这一步我想计数 timestamps 今天找到 3 个时间戳,但 count 返回 1 并且不起作用!
更新完整代码:
$query->condition('node_revision.nid', $node->nid);
怎么做? 谢谢你的帮助...
【问题讨论】:
-
你在哪里使用了count函数,你能显示它是显示1作为回报吗?
-
if ($accessdate === $currentdate) { if (count($timestamp) >3) { } }
-
是的,请添加您的整个代码,以便我们可以假设您尝试了什么以及在哪里出错。编辑问题并输入整个代码。
-
count( $items) > 3 -
我应该找到今天的时间戳
$items有所有的时间戳!