Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the principle of PHP automatically updating the site map every 15 minutes?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

PHP automatically updates the website map every 15 minutes, what is the principle, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can learn, I hope you can harvest.

Recently, I have been working on a short website and wrote my own code. Exercise yourself. In doing html sitemap this, thinking of all the generated short links are displayed, easy to include. I wrote a sitemap.php, and later found that if there is a lot of traffic or too much data in the future, the server burden will be particularly heavy. If there are 10w pieces of data, everyone will index these 10w pieces of data from the database when accessing them. There are 100 people accessing them in one second, and the server simply cannot afford it. Then came the idea of generating html maps.

Due to poor learning skills, there may be some wrong ideas. I wish there were better ways to criticize!

Principle:

Three documents are required:

sitemap.html (a clone of sitemap.php)

sitemap.php (main page, determines page style, etc., complete =sitemap.html)

timeSitemap.php (Generate html pages for updating programs. Monitoring can be set up in the monitoring treasure.)

sitemap.php is a page file, sitemap.html is a clone of sitemap.php. Monitoring treasure sets timeSitemap.php file to generate a site map every 15 minutes. Of course, the frequency is determined according to the monitoring frequency of the monitoring treasure. If the map generation fails, it will return 404, and the monitoring treasure will alarm. sitemap.xml is the same.

The following shared code (with the use of mysql query and other classes for their own simple encapsulated database classes, not shown here):

sitemap.php

Site Map-Data This page is updated every 15 minutes Link: bba.fun Short URL API Interface Site Map

Generate links:

2017©

timeSitemap.php

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report