- <?php
- include("db.php");
- $db = new DB;
- date_default_timezone_set('Asia/Chongqing');
- /**
- * 百图地图生成器
- * 修改自杰奇xml google地图生成
- * 作者: Akuj
- * 第六中文网 www.6zh.net
- */
- function writeStatistic($sql,$txt_name){
- $filename=$txt_name;//注意修改文件的路径
- if (file_exists($filename)) {
- $fp=fopen($filename,"a+");
- }else{
- $fp=fopen($filename,"w+");
- }
-
- $text=$sql."\r\n";
- fwrite($fp,$text);
- fclose($fp);
- }
- function writeStatistic_set_name($txt_name){
- $set_name="<?xml version="1.0" encoding="UTF-8"?>
- <urlset>
- <url> ";
-
- $filename=$txt_name;//注意修改文件的路径
-
- if (file_exists($filename)) {
- unlink($filename);
- $fp=fopen($filename,"a+");
- }else{
- $fp=fopen($filename,"w+");
- }
-
- $text=$set_name."\r\n";
- fwrite($fp,$text);
- fclose($fp);
- }
- $txt_name='sitemap.xml';
- writeStatistic_set_name($txt_name);
- $sql="select * from jieqi_article_article";
- $db->query($sql);
- for($i=1;$i<= $db->num_rows();$i++){
- $db->next_record();
-
- // $siteid = $db->f(siteid);
- $articleid = $db->f(articleid);
- /**
- 这里是小说书籍信息页地址,你也可以修改成你的小说章节目录地址,这个自己选择
- */
- $url = "<loc>http://www.6zd.com/book/$articleid.html</loc>
- <lastmod>".date("Y-m-d")."</lastmod>
- <changefreq>daily</changefreq>
- <priority>1.0</priority>";
-
- writeStatistic($url,$txt_name);
- }
- $db->free();
- $over='</url>
- </urlset>';
- writeStatistic($over,$txt_name);
- print "OK";
- exit;
- ?>
复制代码
Parse error: syntax error, unexpected T_DNUMBER in D:\wwwroot\www.xxx.com\bmapxml.php on line 26
报错 |