我应该找到今天的时间戳,如果计数超过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
)
这一步我想让timestamp
s今天找到3个时间戳,但是count
返回却1
无法正常工作!
更新完整代码:
$query->condition('node_revision.nid', $node->nid);
怎么办 谢谢你的帮助...
尝试这样。在此输出我得到一个count
作为2
$items = array(array('timestamp'=>1570877769),array('timestamp'=>1570877783),array('timestamp'=>1510877794));
$currentdate=date("d-m-Y");
$count = 0;
foreach ($items as $newarrays) {
if($currentdate == date("d-m-Y",$newarrays['timestamp'])){
$count++;
}
}
echo $count;
exit;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句