文件还在测试中

This commit is contained in:
2026-08-08 15:53:53 +08:00
parent 5f1e7adb64
commit 8101177cb5
241 changed files with 18074 additions and 22 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace App\Controllers;
use App\Models\Page;
class PageController extends Controller
{
public function show($slug)
{
$page = new Page();
$p = $page->bySlug($slug);
if (!$p) { \Core\App::notFound(); return ''; }
$pTitle = e($p['title'] ?? '页面');
$pSummary = mb_substr(strip_tags($p['summary'] ?? $p['body'] ?? ''), 0, 160);
$seo = page_seo($slug, [
'title' => $pTitle,
'description' => $pSummary,
'keywords' => '',
'og_type' => 'article',
]);
return $this->view('page/show', [
'pageSeo' => [
'title' => $seo['title'],
'description' => $seo['description'],
'keywords' => $seo['keywords'],
'og_type' => $seo['og_type'] ?: 'article',
'og_image' => $seo['og_image'],
'canonical' => $seo['canonical'],
'noindex' => $seo['noindex'],
'breadcrumb' => [
['name' => '首页', 'url' => site_url()],
['name' => $p['title'] ?? '页面', 'url' => absolute_url()],
],
],
'p' => $p,
]);
}
}