How to generate static html in batch in PHP
This article mainly explains "how to generate static html in batch in PHP". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to generate static html in batch in PHP.
As we all know, the news or commodity information of most websites are static pages. The main benefits of this are: 1, speed up the access speed, avoid excessive operation of the database; 2, SEO optimization, easy to be included in the search engine.
This example revolves around the static page scheme of the CMS system and shows the function of batch generating static html.
Note: this program can only be run by executing PHP commands under DOS or Linux of Windows.
This example mainly has four files: config.inc.php (configuration file), Db.class.php (database PDO class), Model.class.php (PDO database operation class), and index.php (execution file).
Config.inc.php
The copy code is as follows:
Db.class.php
The copy code is as follows:
Model.class.php
The copy code is as follows:
Index.php
The copy code is as follows:
Run screenshot (DOS of Windows as an example)
Screenshot after running:
More than 9000 html can be generated in about 2 minutes.
At this point, I believe you have a deeper understanding of "how to generate static html in batch in PHP". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!