Home>Article>Backend Development> Foolish php+mysql pseudo-static (real html page)
The content of this article is about the fool-like php mysql pseudo-static (real existing html page), which has a certain reference value. Now I share it with everyone. Friends in need can refer to it
Everyone should know about pseudo-static
For example, the page generated by your php page is xxx.php?id=1
For SEO and easy crawling by search engines such as Baidu, and to prevent server resources from being occupied during high concurrency
We should display the link to the xxx.php?id=1 page as xxx_1.html or other similar formats, anyway, the .html suffix is.
I didn't delve into this myself, but I implemented this briefly.
1 A simple list
$row[title]
"; }else{ echo "$row[title]
"; } } mysql_close($con); ?>
As shown in the picture:
The important thing is that the p.php page
queries the database url field, if it is empty , then start file_get_contents to obtain the html code of the entire page, and then write the code to an html file named LKY_$id.html, where $id is the id of the current page. If the current page id=1, then the generated The file name is LKY_1.html, and then the file name is updated to the url field of the database
When the user accesses xxx.p.php?id=1, the database will be queried. If the url field is empty, then the html of the entire page is obtained. The source of the html page is obtained using a get_html.php
After obtaining it, generate the html file and save it in the directory specified by us on the server. If you access xxx.p.php?id=1 and judge that the url field is not empty, then directly output the page data or jump to LKY_1.html
Then a corresponding judgment is made in the list on the homepage to determine whether the url is empty. If it is empty, the output is the hyperlink of p.php?id=1, otherwise from the database Take the html file name of the url field and output LKY_1.html
# What I want to say is that this is actually generating html files!
#
The above is the detailed content of Foolish php+mysql pseudo-static (real html page). For more information, please follow other related articles on the PHP Chinese website!