Php file operations .? Phpif (! Opening, w +); open the file in read/write mode if (is_writable If (! Is_dir ('txt ') // determines whether the txt file is a folder directory.
{
Mkdir ('txt '); // create a directory named txt
$ Open = fopen ('txt/in.txt ', "w +"); // open a file in read/write mode.
If (is_writable ('txt/in.txt ') // if this file is in writable mode
{
If (fwrite ($ open, "Today is a wonderful day and you must be happy! --")> 0) // write content
Fclose ($ open); // close the file
Echo "script" alert ('write succeeded '); script "; // A success prompt is displayed.
}
}
Else
{
If (is_file ('txt/in.txt ') // The Directory contains the in.txt file.
{
If (is_readable ('txt/in.txt ') // checks whether the file is readable.
{
Echo file_get_contents ('txt/in.txt '); // output text information
Unlink ('txt/in.txt '); // delete the file in.txt
Rmdir ('txt '); // delete the Directory
}
}
}
?>
From ms. RMB
Http://www.bkjia.com/PHPjc/478239.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478239.htmlTechArticle? Php if (! Is_dir (txt) // Determine whether the txt is a folder directory {mkdir (txt); // create a directory named txt $ open = fopen (txt/in.txt, w + ); // open the object if (is_writable...