企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
>[info] 计算按天数 ~~~ if (!function_exists('countDays')) { /** * 计算按天数 */ function countDays($a, $b = 0) { if ($b == 0) { $b = date("Y-m-d"); } $date_1 = $a; $date_2 = $b; $d1 = strtotime($date_1); $d2 = strtotime($date_2); $days = round(($d2 - $d1) / 3600 / 24); if ($days > 0) { return $days; } else { return 0; } } } ~~~ 示例: ~~~ $item->delay = countDays(date("Y-m-d"),date('Y-m-d', $item->end_time)); ~~~ ![](https://img.kancloud.cn/90/f5/90f5b9a875ddde17e1d6e72977cbd326_1117x424.png) ![](https://img.kancloud.cn/25/54/255485217aaab4044d225565fd8bad23_1601x765.png)