destoon根据目录下的html文件生成地图索引

因为项目需要,destoon根据目录下的html文件生成地图索引,操作方法,代码如下:

复制代码
<?php
$new_array = array();
function loopDir($dir,&$new_array,$modurl)
{
  $handle = opendir($dir);
  header("Content-Type:text/xml");
$data = '<?xml version="1.0" encoding="UTF-8"?>';
$data .= '<urlset>';
  while(($file = readdir($handle))!== false ){
	  $today=date('Y-m-d', time());
    if ($file != '.' &&$file != 'index.php' && $file != 'indexhtml.php' && $file != '..'){
      if (filetype($dir.'/'.$file) != 'dir'){
		  $modurl="http://www.nongpin88.com/sitemap/";
		  $fileurl=$modurl."html/".$file;
		  $data .= '<url>';
          $data .= '<loc>'.$fileurl.'</loc>';
$data .= '<lastmod>'.$today.'</lastmod>';
$data .= '</url>';	

      }
      if (filetype($dir.'/'.$file) == 'dir'){
        loopDir($file,$new_array);
      }
    }
  }
  $data .= $item;
  $data .= '</urlset>';
$data = str_replace('><', ">\n<", $data);
echo $data;
}


$dir = './';
loopDir($dir,$new_array,$modurl);

?>

演示地址:模块地图 (nongpin88.com)http://www.nongpin88.com/sitemap/html/

相关推荐
nvd1114 分钟前
企业级 LLM 实战:在受限环境中基于 Copilot API 构建 ReAct MCP Agent
前端·copilot
Dragon Wu23 分钟前
TailWindCss cva+cn管理样式
前端·css
烤麻辣烫28 分钟前
Web开发概述
前端·javascript·css·vue.js·html
上天_去_做颗惺星 EVE_BLUE29 分钟前
Android设备与Mac/Docker全连接指南:有线到无线的完整方案
android·linux·macos·adb·docker·容器·安卓
zhangphil29 分钟前
Android显示系统性能分析:trace的HWUI All Memory与HWUI Misc Memory
android
Front思38 分钟前
Vue3仿美团实现骑手路线规划
开发语言·前端·javascript
2501_9160088939 分钟前
iOS开发APP上架全流程解析:从开发到App Store的完整指南
android·ios·小程序·https·uni-app·iphone·webview
徐同保41 分钟前
Nano Banana AI 绘画创作前端代码(使用claude code编写)
前端
Ulyanov42 分钟前
PyVista与Tkinter桌面级3D可视化应用实战
开发语言·前端·python·3d·信息可视化·tkinter·gui开发
计算机程序设计小李同学42 分钟前
基于Web和Android的漫画阅读平台
java·前端·vue.js·spring boot·后端·uniapp