时间:
浏览量:
"文章不存在", "content" => "抱歉,您查看的文章不存在或已被删除。", "date" => date('Y-m-d'), "views" => 0 ]; } else { // 确保必要字段存在 $newsData['title'] = isset($newsData['title']) ? $newsData['title'] : (isset($newsData['subject']) ? $newsData['subject'] : '无标题'); $newsData['content'] = isset($newsData['content']) ? $newsData['content'] : '无内容'; $newsData['date'] = isset($newsData['date']) ? $newsData['date'] : (isset($newsData['createtime']) ? date('Y-m-d', strtotime($newsData['createtime'])) : date('Y-m-d')); $newsData['views'] = isset($newsData['views']) ? $newsData['views'] : 0; // 如果有channel_id,尝试获取频道名称 if (isset($newsData['channel_id'])) { try { $channel = Db::table('pr_cms_channel') ->where('id', $newsData['channel_id']) ->first(['name']); if ($channel && !empty($channel['name'])) { $currentChannel = $channel['name']; } } catch (Exception $e) { // 发生异常时保持默认频道名称 } } } // 轮播图数据 - 使用当前频道名称 $carouselItems = [ [ "image" => "/images/test-header-2.png", "alt" => $currentChannel ] ]; ?>
时间:
浏览量: