<?php
header('Content-Type: application/xml; charset=utf-8');
$currentHost = $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] ?? '');
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$origin = $currentHost ? $scheme . '://' . $currentHost : '';
$today = date('Y-m-d');
$urls = ['/', '/jingxuan/', '/zhuanti/', '/chuangzuo/', '/zhinan/', '/gonggao/', '/bangzhu/', '/guize/', '/tougao/', '/lianxi/', '/author/', '/update/', '/focus/'];
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php foreach ($urls as $url): ?>
  <url>
    <loc><?php echo htmlspecialchars($origin . $url, ENT_XML1, 'UTF-8'); ?></loc>
    <lastmod><?php echo $today; ?></lastmod>
    <changefreq><?php echo $url === '/' ? 'daily' : 'weekly'; ?></changefreq>
    <priority><?php echo $url === '/' ? '1.0' : '0.8'; ?></priority>
  </url>
<?php endforeach; ?>
</urlset>
