每次向数据库取5条数据,不足5条就不显示
$z = (int)(count($data) / 5);
for ($ii = 1; $ii <= $z; $ii++) {
foreach ($data as $k => $v) {
if ($k <= $ii * 5 - 1) {
$v['cover_id']=get_post($v['cover_id']);
$dd[$ii][] = $v;
// unset($dd[$ii][$k]['category_id']);
unset($data[$k]);
}
}
}
php组成数组
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240825082459112-376424429.jpg)