国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home PHP Libraries Other libraries PHP class that generates Baidu sitemap sitemap
PHP class that generates Baidu sitemap sitemap
<?php
/*
 * SiteMap接口類
 */
class SitemapAction extends Action{
  private static $baseURL = ''; //URL地址
  private static $askMobileUrl = 'http://m.xxx.cn/ask/'; //問(wèn)答移動(dòng)版地址
  private static $askPcUrl = "http://www.xxx.cn/ask/";   //問(wèn)答pc地址
  private static $askZonePcUrl = "http://www.xxx.cn/ask/jingxuan/"; //問(wèn)答精選Pc鏈接
  private static $askZoneMobileUrl = "http://m.xxx.cn/ask/jx/"; //問(wèn)答精選移動(dòng)版鏈接
  //問(wèn)答setmaps
  public function askSetMap(){
    header('Content-type:text/html;charset=utf-8');
    //獲取問(wèn)題列表
    $maxid = 0;    //索引文件最大id
    $minid = 0;    //索引文件最小id
    $psize = 1000; //數(shù)據(jù)庫(kù)每次取數(shù)量
    $maxXml = 5000; //xml寫入記錄數(shù)量
    $where = array();
    //讀取索引文件
    $index = APP_PATH.'setmapxml/Index.txt';
    //關(guān)聯(lián)setmaps路徑
    $askXml = "../siteditu/ask/ask.xml";
    if(!file_exists($index)){
      $fp=fopen("$index", "w+");
      if ( !is_writable($index) ){
        die("文件:" .$index. "不可寫,請(qǐng)檢查!");
      }

First take out 1000 pieces of data (which can be more flexible and convenient for later modification), and then generate xml format files in a loop. file_puts_contens writes files. Then write the name of the generated xml file, the minimum id of the retrieved question, the maximum id of the retrieved question, and the number of retrieved questions into a txt file for index query. The format is roughly like this.
0,3146886,3145887,1000
Did you find that the last number is 1000? The first time you select, take out 1000 pieces of data, and then write it into the 0.xml file. Write the extracted xml file name, minimum id, maximum id, and number of entries into the index query txt. For the first time, 1,000 pieces of data were written to 0.xml, and the number of pieces generated was 1,000. The select statement will become when querying for the second time. where id > The maximum id taken out (currently mysql is a forward order query, if it is in reverse order, change it to less than) limit 1000 In this case, take out 1000, and then modify the minimum id and maximum id of the index query txt, and add the number of generated items to 2000 . By analogy, when the number of generated items reaches 5000, start another line and write it into the index file, similar to this
0,3146886,3145887,5000
1,3148886,3147887,1000
If you write it like this, it will reduce the problem. reduces the pressure on the server.

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

How Do I Link Static Libraries That Depend on Other Static Libraries? How Do I Link Static Libraries That Depend on Other Static Libraries?

13 Dec 2024

Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

How to Silence TensorFlow\'s Debugging Output? How to Silence TensorFlow\'s Debugging Output?

28 Oct 2024

Suppression of Tensorflow Debugging OutputTensorflow prints extensive information about loaded libraries, found devices, and other debugging data...

How Does jQuery Simplify DOM Manipulation for Web Developers? How Does jQuery Simplify DOM Manipulation for Web Developers?

03 Jan 2025

Overflow: Hidden and Expansion of HeightjQuery distinguishes itself from other JavaScript libraries through its cross-platform compatibility and...

Which native Java image processing library is right for you? Which native Java image processing library is right for you?

30 Oct 2024

Native Java Image Processing Libraries for High-Quality ResultsAs you have encountered limitations with ImageMagick and JAI, let's explore other...

How to Create and Utilize Static Libraries in g  ? How to Create and Utilize Static Libraries in g ?

24 Oct 2024

This article guides developers on crafting static libraries in C using g . It demonstrates how to compile source code into object files, create static libraries, and incorporate them into other projects. By leveraging this approach, developers can

How to Execute Command Line Binaries in Node.js? How to Execute Command Line Binaries in Node.js?

27 Dec 2024

Executing Command Line Binaries in Node.jsExecuting third-party binaries is an essential task when porting CLI libraries from other languages to...

See all articles