1, through the buffer to achieve the need to use file_put_contents Ob_get_clean () and other built-in functions Ob_start (); include "filterpost.html"; $mtime = Filemtime ("./ Filterpost.html ");//Here you can determine whether a file exists and expires, then do a cache or generate a static file operation $pagecache = Str_replace (' submit2 ', ' Login ', ob_get_contents () );//Replace the cached contents with Ob_end_clean (); Echo $mtime; Echo $pageCache; 2, through $_server[' path_info ' to achieve echo ' <pre> ';p rint_r ($_server);p reg_match ('/^\/(\d+) \ (\d+) \.html/', $_server[ ' Path_info '], $arr);p Rint_r ($arr); 3, through the Apache configuration to achieve the need to open the rewrite rewrite module through the rewrite to configure Vhost
Rewriteengine on
Rewritecond%{document_root}%{request_filename}!-d
Rewritecond%{document_root}%{request_filename}!-f
Rewriterule ^/detail/([0-9]*). html$/detail.php?id=$1
If the folder and its files do not exist under the server, then rewrite the definition to/detail.php
If there is no 1.html under the detail folder then rewrite the definition to./detail.php 4, configure rewrite ^/detail/(\d+) \.html$/detail.php in nginx.conf via Nginx configuration? Id=$1 last;
PHP implementation of page static