文件
2026-06-04 22:42:27 +08:00

402 行
13 KiB
PHP

<?php
session_start();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Parlz 文档中心</title>
<link rel="stylesheet" href="../style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--bg-primary: #f5f5f5;
--bg-secondary: #ffffff;
--bg-tertiary: #fafafa;
--bg-hover: #f5f5f5;
--text-primary: #333333;
--text-secondary: #666666;
--text-tertiary: #999999;
--border-color: #e0e0e0;
--accent-color: #07c160;
--accent-hover: #00a86b;
--shadow-color: rgba(0, 0, 0, 0.1);
--shadow-hover: rgba(0, 0, 0, 0.15);
}
body.dark-mode {
--bg-primary: #1a1a1a;
--bg-secondary: #2d2d2d;
--bg-tertiary: #3d3d3d;
--bg-hover: #4d4d4d;
--text-primary: #ffffff;
--text-secondary: #b8b8b8;
--text-tertiary: #888888;
--border-color: #3d3d3d;
--accent-color: #4caf50;
--accent-hover: #66bb6a;
--shadow-color: rgba(0, 0, 0, 0.3);
--shadow-hover: rgba(0, 0, 0, 0.4);
}
body {
background: var(--bg-primary);
margin: 0;
padding: 0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: var(--text-primary);
transition: background-color 0.3s ease, color 0.3s ease;
}
.docs-container {
max-width: 1200px;
margin: 0 auto;
padding: 40px 20px;
}
.docs-header {
text-align: center;
margin-bottom: 60px;
padding: 60px 20px;
background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
color: white;
border-radius: 12px;
box-shadow: 0 4px 20px var(--shadow-color);
}
.docs-header h1 {
font-size: 42px;
margin-bottom: 20px;
font-weight: 700;
}
.docs-header p {
font-size: 18px;
margin-bottom: 30px;
opacity: 0.9;
}
.docs-nav {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 30px;
margin-bottom: 60px;
}
.docs-card {
background: var(--bg-secondary);
border-radius: 10px;
padding: 30px;
box-shadow: 0 2px 10px var(--shadow-color);
transition: all 0.3s ease;
}
.docs-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 25px var(--shadow-hover);
}
.docs-card-icon {
font-size: 48px;
color: var(--accent-color);
margin-bottom: 20px;
}
.docs-card h2 {
font-size: 24px;
margin-bottom: 15px;
color: var(--text-primary);
}
.docs-card p {
color: var(--text-secondary);
line-height: 1.6;
margin-bottom: 20px;
}
.docs-card-link {
display: inline-block;
padding: 10px 20px;
background: var(--accent-color);
color: white;
text-decoration: none;
border-radius: 6px;
font-weight: 500;
transition: all 0.3s ease;
}
.docs-card-link:hover {
background: var(--accent-hover);
transform: translateY(-2px);
}
.docs-features {
background: var(--bg-secondary);
border-radius: 12px;
padding: 50px;
box-shadow: 0 2px 10px var(--shadow-color);
margin-bottom: 60px;
}
.docs-features h2 {
text-align: center;
font-size: 32px;
margin-bottom: 40px;
color: var(--text-primary);
}
.features-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 30px;
}
.feature-item {
text-align: center;
padding: 20px;
}
.feature-icon {
font-size: 36px;
color: var(--accent-color);
margin-bottom: 15px;
}
.feature-item h3 {
font-size: 18px;
margin-bottom: 10px;
color: var(--text-primary);
}
.feature-item p {
color: var(--text-secondary);
line-height: 1.5;
}
.docs-footer {
text-align: center;
padding: 40px 20px;
background: #333;
color: white;
border-radius: 12px;
margin-top: 60px;
}
.docs-footer p {
margin-bottom: 10px;
}
.docs-footer-links {
margin-top: 20px;
}
.docs-footer-links a {
color: var(--accent-color);
text-decoration: none;
margin: 0 15px;
transition: color 0.3s ease;
}
.docs-footer-links a:hover {
color: var(--accent-hover);
text-decoration: underline;
}
/* 主题切换按钮 */
.theme-toggle-btn {
position: fixed;
top: 20px;
right: 20px;
width: 40px;
height: 40px;
border-radius: 50%;
background: var(--bg-secondary);
border: 1px solid var(--border-color);
color: var(--text-primary);
font-size: 18px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2px 8px var(--shadow-color);
transition: all 0.3s ease;
z-index: 1000;
}
.theme-toggle-btn:hover {
transform: scale(1.1);
box-shadow: 0 4px 12px var(--shadow-hover);
}
/* 响应式设计 */
@media (max-width: 768px) {
.docs-header {
padding: 40px 20px;
}
.docs-header h1 {
font-size: 32px;
}
.docs-container {
padding: 20px 15px;
}
.docs-features {
padding: 30px 20px;
}
.docs-card {
padding: 20px;
}
}
</style>
</head>
<body>
<button class="theme-toggle-btn" id="theme-toggle-btn">
<i class="fas fa-moon"></i>
</button>
<?php include 'includes/navbar.php'; ?>
<div class="docs-container">
<div class="docs-header">
<h1>Parlz 文档中心</h1>
<p>全面的使用指南、API文档和开发资源</p>
<a href="../index.php" class="docs-card-link">
<i class="fas fa-arrow-left"></i> 返回应用
</a>
</div>
<div class="docs-nav">
<?php
// 扫描目录下以doc_开头的php文件
$docFiles = glob('doc_*.php');
// 默认文档卡片
$defaultCards = [
[
'icon' => 'book',
'title' => '用户指南',
'description' => '了解如何使用Parlz的各项功能,包括注册、登录、发送消息、创建群组等。',
'link' => 'terms.php',
'linkText' => '查看用户协议'
],
[
'icon' => 'code',
'title' => 'API文档',
'description' => '详细的API接口说明,帮助开发者集成Parlz的功能到自己的应用中。',
'link' => '#',
'linkText' => '查看API文档'
],
[
'icon' => 'question-circle',
'title' => '常见问题',
'description' => '解答用户在使用过程中遇到的常见问题,提供快速的解决方案。',
'link' => '#',
'linkText' => '查看FAQ'
]
];
// 显示文档文件卡片
foreach ($docFiles as $file) {
// 提取文件名(去掉扩展名)
$fileName = basename($file, '.php');
$displayName = str_replace('doc_', '', $fileName);
$displayName = ucwords(str_replace('_', ' ', $displayName));
// 简单的文件信息提取
$fileContent = file_get_contents($file);
$description = '文档内容';
// 尝试从文件中提取标题
if (preg_match('/<title>(.*?)<\/title>/i', $fileContent, $matches)) {
$title = $matches[1];
} else {
$title = $displayName;
}
// 尝试从文件中提取描述
if (preg_match('/<meta name="description" content="(.*?)">/i', $fileContent, $matches)) {
$description = $matches[1];
}
echo '<div class="docs-card">';
echo '<div class="docs-card-icon">';
echo '<i class="fas fa-file-alt"></i>';
echo '</div>';
echo '<h2>' . htmlspecialchars($title) . '</h2>';
echo '<p>' . htmlspecialchars($description) . '</p>';
echo '<a href="' . htmlspecialchars($file) . '" class="docs-card-link">';
echo '<i class="fas fa-chevron-right"></i> 查看文档';
echo '</a>';
echo '</div>';
}
// 如果没有文档文件,显示默认卡片
if (empty($docFiles)) {
foreach ($defaultCards as $card) {
echo '<div class="docs-card">';
echo '<div class="docs-card-icon">';
echo '<i class="fas fa-' . $card['icon'] . '"></i>';
echo '</div>';
echo '<h2>' . $card['title'] . '</h2>';
echo '<p>' . $card['description'] . '</p>';
echo '<a href="' . $card['link'] . '" class="docs-card-link">';
echo '<i class="fas fa-chevron-right"></i> ' . $card['linkText'];
echo '</a>';
echo '</div>';
}
}
?>
</div>
<div class="docs-footer">
<p>&copy; 2026 Parlz. 保留所有权利。</p>
<p>版本:1.0 | 最后更新:2026年1月29日</p>
<div class="docs-footer-links">
<a href="terms.php">用户协议</a>
<a href="#">隐私政策</a>
<a href="#">联系我们</a>
</div>
</div>
</div>
<script>
// 主题切换功能
function initThemeToggle() {
const themeToggleBtn = document.getElementById('theme-toggle-btn');
const themeIcon = themeToggleBtn.querySelector('i');
// 从localStorage读取主题设置
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'dark') {
document.body.classList.add('dark-mode');
themeIcon.classList.remove('fa-moon');
themeIcon.classList.add('fa-sun');
}
// 点击切换主题
themeToggleBtn.addEventListener('click', function() {
document.body.classList.toggle('dark-mode');
const isDark = document.body.classList.contains('dark-mode');
if (isDark) {
themeIcon.classList.remove('fa-moon');
themeIcon.classList.add('fa-sun');
localStorage.setItem('theme', 'dark');
} else {
themeIcon.classList.remove('fa-sun');
themeIcon.classList.add('fa-moon');
localStorage.setItem('theme', 'light');
}
});
}
// 页面加载完成后初始化
window.addEventListener('DOMContentLoaded', initThemeToggle);
</script>
</body>
</html>