Copy code The code is as follows:
function makedir($mudir) //Create directory
{
$file = "./$mudir";
@mkdir($file,0777);
}
function writemod($filemodname) //Create the subtemplate file path first
{
$fp=fopen("showmod.shtml","r");
$str=fread($fp,filesize("showmod.shtml"));
fclose($fp);
$fp=fopen($filemodname,"w");
fwrite($fp,$str);
fclose($fp);
}
function writeweb($content,$ web,$modfile) //Update respective sub-template files //$modfile is the name of the sub-template
{
$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);
}
$m = "00000";
makedir($m);
$ff = $m."/0001.shtml";
if(!file_exists($ff))
{
writemod($ff);
}
else
{
echo "already exists";
}
$d="{content6}"; //Updated content
$dd="";//Content to be updated//To be updated Updated content
@writeweb($d,$dd,$ff);
?>
http://www.bkjia.com/PHPjc/317233.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/317233.htmlTechArticleCopy the code as follows: ? functionmakedir($mudir)//Create directory { $file="./$mudir "; @mkdir($file,0777); } functionwritemod($filemodname)//First create sub-template file path { $fp=fopen...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn