Copy CodeThe code is as follows:
/*
Traverse the folder; Function: (a) can delete the file (b) editable text, Web page file (c) can delete the folder, if the folder is empty (d) can establish files, folders, modify the folder name;
lost63.com original, reproduced please indicate the source. AC qq:35501547
*/
$path = $DOCUMENT _root;
$path =str_replace ("/", "\ \", $path);
Specify folder
$path = $path. " \\";
if ($_get[' folder ')
{
$path. =$_get[' folder ']. " \\";
}
This page path, will be used when the following return;
$url =$_server[' php_self '];
If it is a folder, the link will be added;
Function folder ($path, $str)
{
if (filetype ($path. $str) = = "Dir")
{
return "$STR";
}else{
return $str;
}
}
Switch ($_get[' action ')
{
Case "Del";
if ($_get[' type ']== "file")
{
Unlink ($_get[' path ');
}else{
RmDir ($_get[' path ');
}
echo "";
Break
Case "edit";
if ($_get[' type ']== "file")
{
$file =fopen ($_get[' path '], "R");
while (!feof ($file))
{
$result. =fgets ($file, 9999);
}
Fclose ($file);
Echo ';
}else{
Echo ';
}
Break
Case "Editsave";
$file =fopen ($_get[' path '], "w");
Fwrite ($file, $_post[' textarea ');
Fclose ($file);
echo "";
Break
Case "AddFile";
Echo ';
Break
Case "FileSave";
Include point to create file or create folder
if (Strpos ($_post[' filename '], "."))
{
$file =fopen ($_post[' filename '], "w");
Fwrite ($file, $_post[' textarea ');
Fclose ($file);
}else{
If the folder exists then exits, does not exist then establishes!
if (file_exists ($_post[' filename '))
{
Exit
}else{
mkdir ($_post[' filename ');
}
}
echo "";
Break
Case "Dir_rename";
Rename ($_get[' path '],$_post[' filename ');
echo "";
Break
Default
$s =explode ("\ n", Trim (' dir/b/o:gn $path '));
Echo '
>> file Management > build file > Return |
Files/Folders |
File properties |
File size |
Operation |
'; foreach ($s as $value) {echo '
'. folder ($path, $value). ' |
'. FileType ($path. $value). ' |
'. Round (FileSize ($path. $value)/1024). ' Kb |
Edit | '. $value. ' \');" > Delete |
'; } echo "
";
Break
}
?>
http://www.bkjia.com/PHPjc/321015.html www.bkjia.com true http://www.bkjia.com/PHPjc/321015.html techarticle Copy the code as follows:? PHP/* Traverse folder; function: (a) can delete file (b) editable text, Web page file (c) can delete folder, if the folder is empty (d) can establish file, text ...