$path = Date ("y-m-d");
$filename = ' 111cn.net.html ';
$content = ' original www.111cn.net, reproduced annotated original ';
Tohtmlfile ($filename, $content);
function Tohtmlfile ($file _name, $file _content)
{
$dir _name=dirname ($file _name);
Create a directory if it does not exist
if (!file_exists ($dir _name))
{
Mkdirs ($dir _name);
}
if (file_exists ($file _name)) {
@unlink ($file _name); File exists, delete
}
$cjjer _handle = fopen ($file _name, "w+"); Create a file
if (!is_writable ($file _name)) {//Judge Write permission
Exit (' cannot write file ');
}
if (!fwrite ($cjjer _handle, $file _content)) {
Exit (' Write file failed ');
}
Fclose ($cjjer _handle); Close pointer
return $file _name; Return file name
}
Create a directory function
function Mkdirs ($dir)
{
if (!is_dir ($dir)) {
if (!mkdirs (DirName ($dir)) {
Exit (' Cannot create directory ');}
if (!mkdir ($dir, 0777)) {
Exit (' Cannot create directory 2 ');}
}
return true;
}
/*
User Function description
Whether the Is_dir directory is saved
fopen New File
mkdir Create a directory
Fwrite Write files
Fclose closed File
Whether the file_exists file is stored
Unlink Delete Files
More and better manuals http://www.111cn.net/w3school/php/
*/