这个类可以用来生成网站地图,并通知搜索引擎的更新。 建立一个网站地图文件的URL列表。URL的最后修改日期,变更频率和优先级。该sitemap文件可能被保存在压缩格式。 并且将更新网站地图地址的网站的robots.txt文件。 当更新网站地图,也可以通知类的搜索引擎
这个类可以用来生成网站地图,并通知搜索引擎的更新。
源码与演示:源码出处 演示出处
PhpEIP企业信息化平台主要解决企业各类信息的集成,能把各种应用系统(如内容管理系统,网上商城,论坛系统等)统一到企业信息化平台中,整个系统采用简单易用的模板引擎,可自定义XML标签,系统采用开放式模块开发,符合开发接口的模块可完全嵌入到平台;内容管理模块可自定义内容模型,系统自带普通文章模型和图片集模型,用户可以定义丰富的栏目构建企业门户,全站可生成静态页面,提供良好的搜索引擎优化;会员管理模
0

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
// include class
include 'SitemapGenerator.php';
// create object
$sitemap = new SitemapGenerator("http://www.codepearl.com/");
// add urls
$sitemap->addUrl("http://www.codepearl.com", date('c'), 'daily', '1');
$sitemap->addUrl("http://www.codepearl.com/page1", date('c'), 'daily', '0.5');
$sitemap->addUrl("http://www.codepearl.com/page2", date('c'), 'daily');
$sitemap->addUrl("http://www.codepearl.com/page3", date('c'));
$sitemap->addUrl("http://www.codepearl.com/page4");
$sitemap->addUrl("http://www.codepearl.com/page/subpage1", date('c'), 'daily', '0.4');
$sitemap->addUrl("http://www.codepearl.com/page/subpage2", date('c'), 'daily');
$sitemap->addUrl("http://www.codepearl.com/page/subpage3", date('c'));
$sitemap->addUrl("http://www.codepearl.com/page/subpage4");
// create sitemap
$sitemap->createSitemap();
// write sitemap as file
$sitemap->writeSitemap();
// update robots.txt file
$sitemap->updateRobots();
// submit sitemaps to search engines
$sitemap->submitSitemap();
?>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
$time = explode(" ",microtime());
$time = $time[1];
// include class
include 'SitemapGenerator.php';
// create object
$sitemap = new SitemapGenerator("http://www.codepearl.com/", "../");
// will create also compressed (gzipped) sitemap
$sitemap->createGZipFile = true;
// determine how many urls should be put into one file
$sitemap->maxURLsPerSitemap = 10000;
// sitemap file name
$sitemap->sitemapFileName = "sitemap.xml";
// sitemap index file name
$sitemap->sitemapIndexFileName = "sitemap-index.xml";
// robots file name
$sitemap->robotsFileName = "robots.txt";
$urls = array(
array("http://www.codepearl.com", date('c'), 'daily', '1'),
array("http://www.codepearl.com/mainpage1", date('c'), 'daily', '0.5'),
array("http://www.codepearl.com/mainpage2", date('c'), 'daily'),
array("http://www.codepearl.com/mainpage3", date('c')),
array("http://www.codepearl.com/maonpage4"));
// add many URLs at one time
$sitemap->addUrls($urls);
// add urls one by one
$sitemap->addUrl("http://www.codepearl.com/page1", date('c'), 'daily', '0.5');
$sitemap->addUrl("http://www.codepearl.com/page2", date('c'), 'daily');
$sitemap->addUrl("http://www.codepearl.com/page3", date('c'));
$sitemap->addUrl("http://www.codepearl.com/page4");
$sitemap->addUrl("http://www.codepearl.com/page/subpage1", date('c'), 'daily', '0.4');
$sitemap->addUrl("http://www.codepearl.com/page/subpage2", date('c'), 'daily');
$sitemap->addUrl("http://www.codepearl.com/page/subpage3", date('c'));
$sitemap->addUrl("http://www.codepearl.com/page/subpage4");
try {
// create sitemap
$sitemap->createSitemap();
// write sitemap as file
$sitemap->writeSitemap();
// update robots.txt file
$sitemap->updateRobots();
// submit sitemaps to search engines
$result = $sitemap->submitSitemap("yahooAppId");
// shows each search engine submitting status
echo "<pre class="brush:php;toolbar:false;">";
print_r($result);
echo "
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号