12 Star 39 Fork 15

foru / ForU CMS

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
sitemap.php 967 Bytes
Copy Edit Web IDE Raw Blame History
石榴木 authored 2020-02-21 16:52 . update sitemap.php.
<?php
include './library/inc.php';
header('Content-type: application/xml; charset="UTF-8"', true);
//"always", "hourly", "daily", "weekly", "monthly", "yearly" and "never"
$changefreq = "weekly";
$str = '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
$str .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'.PHP_EOL;
$res = $db->getAll("SELECT * FROM detail ORDER BY d_order ASC,id DESC LIMIT 0,5000");
foreach ($res as $val) {
$str .= ' <url>' . PHP_EOL . ' <loc>' . $cms['s_domain'] . '/' . htmlspecialchars(d_url($val['id'])) . '</loc>' . PHP_EOL . ' <lastmod>' . local_date("Y-m-d H:i:s",$val['d_date']) . '</lastmod>' . PHP_EOL . ' <changefreq>' . $changefreq . '</changefreq>' . PHP_EOL . ' <priority>0.8</priority>' . PHP_EOL . ' </url>' . PHP_EOL;
}
$str .= '</urlset>';
if ($act == 'xml') {
$fp = fopen("sitemap.xml", "w+");
fwrite($fp, $str);
fclose($fp);
header('Location: ./sitemap.xml');
} else {
echo $str;
}

Comment ( 0 )

Sign in for post a comment

PHP
1
https://gitee.com/sw1981/ForU-CMS.git
git@gitee.com:sw1981/ForU-CMS.git
sw1981
ForU-CMS
ForU CMS
dev

Search