page.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
require_once __DIR__ . '/core/Session.php';
require_once __DIR__ . '/core/Security.php';
require_once __DIR__ . '/app/models/Page.php';
require_once __DIR__ . '/app/models/Category.php';
require_once __DIR__ . '/app/models/Setting.php';
Session::start();
$id = (int)($_GET['id'] ?? 0);
$slug = $_GET['slug'] ?? '';
$pageModel = new Page();
$categoryModel = new Category();
$settingModel = new Setting();
if ($slug) {
$page = $pageModel->getPageBySlug($slug);
} else {
$page = $pageModel->getPageWithAuthor($id);
}
if (!$page || ($page['status'] !== 'published' && !Session::isAdmin())) {
header('HTTP/1.0 404 Not Found');
include '404.php';
exit;
}
$settings = $settingModel->getAllSettings();
$categories = $categoryModel->getActiveCategories();
function getSetting($key, $default = '') {
global $settings;
return $settings[$key] ?? $default;
}
$currentCategoryId = 0;
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo Security::cleanXSS($page['title']); ?> - <?php echo Security::cleanXSS(getSetting('site_title', 'PHP个人博客')); ?></title>
<meta name="description" content="<?php echo Security::cleanXSS(Security::truncate(strip_tags($page['content']), 160)); ?>">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<?php include 'views/partials/header.php'; ?>
<main class="site-main">
<div class="container">
<div class="main-content" style="max-width: 900px; margin: 0 auto;">
<article class="page-single">
<header class="page-header">
<h1 class="page-title"><?php echo Security::cleanXSS($page['title']); ?></h1>
<div class="page-meta">
<?php if ($page['author_nickname'] || $page['author_name']): ?>
<span class="page-author"><?php echo Security::cleanXSS($page['author_nickname'] ?: $page['author_name']); ?></span>
<?php endif; ?>
后面还有 17 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
