Files
leonapp/test_auto_footer.php
2025-09-20 22:20:08 +08:00

84 lines
3.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// 包含配置文件 - 这应该会自动添加页脚
require_once 'config.php';
// 检查当前页面路径,用于显示调试信息
$currentScript = $_SERVER['SCRIPT_NAME'];
$isAdminPage = strpos($currentScript, '/admin/') !== false;
?>
<!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 APP_STORE_NAME; ?></title>
<!-- Bootstrap CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome -->
<link rel="stylesheet" href="/css/all.min.css">
<style>
.container {
margin-top: 20px;
margin-bottom: 20px;
}
.card {
margin-bottom: 20px;
}
</style>
</head>
<body>
<!-- 导航栏 -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a href="index.php"><img src="/favicon.jpeg" alt="Logo" style="height: 30px; margin-right: 10px; border-radius: var(--border-radius);"></a>
<a class="navbar-brand" href="index.php">返回首页</a>
</div>
</nav>
<div class="container">
<div class="card">
<div class="card-header">
<h2 class="text-center">自动页脚功能测试</h2>
</div>
<div class="card-body">
<div class="alert alert-info">
<h4 class="alert-heading">测试说明</h4>
<p>这个页面用于测试config.php中的自动页脚功能。</p>
<p>只要引用了config.php文件页脚应该会<strong>自动</strong>显示在页面底部。</p>
<hr>
<p class="mb-0">测试条件和状态:</p>
<ul>
<li>当前页面: <code><?php echo $currentScript; ?></code></li>
<li>是否为管理员页面: <?php echo $isAdminPage ? '是' : '否'; ?></li>
<li>是否为命令行模式: <?php echo php_sapi_name() === 'cli' ? '是' : '否'; ?></li>
<li>是否为AJAX请求: <?php echo !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest' ? '是' : '否'; ?></li>
<li>页脚显示状态: 应该自动显示</li>
</ul>
</div>
<div class="mt-4">
<h3>功能说明</h3>
<p>新的自动页脚功能具有以下特点:</p>
<ul>
<li>只要引用了config.php文件普通页面会<strong>自动</strong>在底部添加页脚</li>
<li>管理员页面不会自动添加页脚,可以手动控制</li>
<li>AJAX请求和命令行模式下不会输出页脚</li>
<li>保持了原有的output_bootstrap_footer()函数,可以在需要的地方手动调用</li>
</ul>
</div>
<div class="mt-4">
<h3>测试链接</h3>
<ul>
<li><a href="test_footer.php" target="_blank">测试手动调用页脚</a></li>
<li><a href="admin/index.php" target="_blank">管理员页面(不会自动显示页脚)</a></li>
</ul>
</div>
</div>
</div>
</div>
<!-- Bootstrap JS Bundle with Popper -->
<script src="js/bootstrap.bundle.js"></script>
</body>
</html>