色www,五月婷婷深爱五月,午夜国产一级片,色噜噜综合,国产大胸无码视频,清纯美女被操黄网站在线观看,波多野结衣av高清一区二区三区

PHPBB生成sitemap地圖文件的方法

時(shí)間:2025-09-10 13:24:15 php語(yǔ)言

PHPBB生成sitemap地圖文件的方法

  本文介紹下,在PHPBB論壇中生成sitemap地圖文件的實(shí)現(xiàn)代碼,感興趣的朋友參考學(xué)習(xí)下。就跟隨百分網(wǎng)小編一起去了解下吧,想了解更多相關(guān)信息請(qǐng)持續(xù)關(guān)注我們應(yīng)屆畢業(yè)生考試網(wǎng)!

  將以下PHP文件放到網(wǎng)站的根目錄。

  加入此sitemap的前提:

  必須將PHPBB論壇的默認(rèn)URL規(guī)格改成以下文件里生成的格式。

  具體方法,請(qǐng)參考:

  /pic/article/13591.html

  注意:

  紅色部分的代碼,修改成自己網(wǎng)站對(duì)應(yīng)的內(nèi)容:

  復(fù)制代碼 代碼示例:

  <?php

  /pic/p>

  /pic/p>

  /pic/p>

  $subdomain='www.';

  $domain=' ';  /pic/p>

  $folder='/forum/';                  /pic/p>

  $urls=50000;

  /pic/p>

  $domainpath='/pic/p>

  /pic/p>

  define('IN_PHPBB', true);

  $phpbb_root_path = './';

  $phpEx = substr(strrchr(__FILE__, '.'), 1);

  include($phpbb_root_path . 'config.' . $phpEx);

  include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);

  $db = new $sql_db();

  $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false);

  /pic/p>

  if (@extension_loaded('zlib') && !headers_sent())

  {

  ob_start('ob_gzhandler');

  }

  /pic/p>

  header("Content-Type: text/xml;charset=iso-8859-1");

  /pic/p>

  echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";

  echo '<urlset xmlns="/pic/schemas/sitemap/0.9">'."\n";

  /pic/p>

  $current_time=time();

  echo '<url>

  <loc>'.$domainpath.'</loc>

  <lastmod>'.date("Y-m-d\TH:i:sP",$current_time).'</lastmod>

  </url>';

  $urls=$urls-1;

  /pic/p>

  $sql = 'SELECT forum_id, forum_last_post_time FROM '.$table_prefix.'forums WHERE enable_indexing=1 LIMIT '.$urls;

  $result = $db->sql_query($sql);

  while ($data=$db->sql_fetchrow($result)) {

  /pic/p>

  if ($data['forum_last_post_time'] == 0) {

  $data['forum_last_post_time']=$current_time;}

  echo '<url>

  <loc>'.$domainpath.'viewforum-'.$data['forum_id'].'.html'.'</loc>

  <lastmod>'.date("Y-m-d\TH:i:sP",$data['forum_last_post_time']).'</lastmod>

  </url>';

  $urls=$urls-1;

  }

  $db->sql_freeresult($result);

  /pic/p>

  $sql = 'SELECT * FROM '.$table_prefix.'topics as t, '.$table_prefix.'forums as f WHERE t.topic_approved=1 AND t.forum_id=f.forum_id AND f.enable_indexing=1 ORDER BY t.topic_id DESC LIMIT '.$urls;

  $result = $db->sql_query($sql);

  while ($data=$db->sql_fetchrow($result)) {

  echo '<url>

  <loc>'.$domainpath.'viewtopic-'.$data['topic_id'].'.html'.'</loc>

  <lastmod>'.date("Y-m-d\TH:i:sP",$data['topic_last_post_time']).'</lastmod>

  </url>';

  }

  $db->sql_freeresult($result);

  /pic/p>

  echo '  </urlset>';

  ?>

【PHPBB生成sitemap地圖文件的方法】相關(guān)文章:

PHP中BB生成sitemap地圖文件的方法12-14

PHP生成SiteMap文件代碼的方法03-01

php自動(dòng)生成sitemap地圖的代碼11-20

php自動(dòng)生成sitemap地圖的代碼12-06

PHP生成SiteMap文件的代碼03-05

php自動(dòng)生成sitemap地圖代碼11-26

php sitemap文件生成器代碼10-21

php生成sitemap.xml的實(shí)例代碼09-06

PHP生成PDF文件withFPDF10-17