Php file operation Basic usage
Generated successfully! "; */$ Con = array ('news title', 'News content'), array ('news title', 'News content2 '), array ('News headlines 3', 'News content3'); foreach ($ con as $ id => $ val) {$ title = $ val [0]; $ content = $ val [1]; your pathpattern incluid.'.htm'; $ fp = fopen ("tmp.html", "r"); // read-only open template $ str = fread ($ fp, filesize ("tmp.html"); // read the template content $ str = str_replace ("{title}", $ title, $ str ); $ str = str_replace ("{content}", $ content, $ str); // replace content fclose ($ fp); $ handle = fopen ($ path, "w"); // write mode to open the news path fwrite ($ h Andle, $ str); // write the replaced content into the generated HTML file fclose ($ handle); echo "generated successfully";} if(unlink('1.htm ')) // delete the file {echo "deleted successfully";} else {echo "failed to delete" ;}; if (mkdir ('up1 ')) {// create a folder echo "created successfully";} else {echo "failed to create";} if (rmdir ('up1 ')) {// delete the folder echo "deleted successfully";} else {echo "failed to delete" ;}?>