Php static page generation method (three functions)
/**
- Create directory
- */
- Function makedir ($ mudir)
- {
- $ File = "./$ mudir ";
- @ Mkdir ($ file, 0777 );
- }
/**
- First, create the path of the child Touch Board file.
- */
- Function writemod ($ filemodname)
- {
- $ Fp = fopen ("showmod.shtml", "r ");
- $ Str = fread ($ fp, filesize ("showmod.shtml "));
- Fclose ($ fp );
- $ Fp = fopen ($ filemodname, "w ");
- Fwrite ($ fp, $ str );
- Fclose ($ fp );
- }
/**
- Update the respective sub-board file // $ modfile is the sub-board name
- */
- Function writeweb ($ content, $ web, $ modfile)
- {
- $ Fp = fopen ($ modfile, "r ");
- $ Str = fread ($ fp, filesize ($ modfile ));
- $ Str = str_replace ($ content, $ web, $ str );
- Fclose ($ fp );
- $ Fp = fopen ($ modfile, "w ");
- Fwrite ($ fp, $ str );
- Fclose ($ fp );
- }
- USD m = "00000 ";
- Makedir ($ m );
- $ Ff = $ m. "/0001.shtml ";
- If (! File_exists ($ ff ))
- {
- Writemod ($ ff );
- }
- Else
- {
- Echo "already exists ";
- }
- $ D = "{content6}"; // Updated content
- $ Dd = ""; // the content to be updated
- @ Writeweb ($ d, $ dd, $ ff );
- ?>
Articles you may be interested in: three methods for generating static pages in php and code details: generating static page functions in php (php2html) for example, php generates html static pages, refer to a class written by php to generate html static pages for all the content in the database. php static page generation detailed tutorial apache cannot access pseudo static page solution php write about static page crawling record Code smarty generate static page method PHP generate static page solution: apache cannot access pseudo-static pages |