abstract:
/**
* 操作配置
*/
include "common.php";
// 判断点击操作
if ($act == "创建文件") {
// 创建文件操作
$mes = create_file($path . "/" . $filename);
// 设置提示弹窗
alertMes($mes, $url);
// 判断点击操作
} elseif ($act == "showContent") {
// 查询文件内容
$content = read_file($filename);
// 判断文件是否有内容
if (strlen($content)) {
// 给字符串添加高亮
$newContent = highlight_string($content, true);
// 制作显示表格
$str = <<
{$newContent} HERE;
echo $str;
} else {
alertMes('文件为空!请编辑后再查看~', $url);
}
// 判断点击操作
} elseif ($act == "editContent") {
// 获取文件内容
$content = file_get_contents($filename);
// 制作表单
$str = <<
HERE;
echo $str;
// 判断操作
} elseif ($act == "doEdit") {
// 获取修改内容
$content = $_REQUEST['content'];
// 进行修改并判断
if (file_put_contents($filename, $content)) {
$mes = '文件修改成功!';
} else {
$mes = '文件修改失败!';
}
alertMes($mes, $url);
} elseif ($act == "renameFile") {
$str = <<
请输入文件新名称:
HERE;
echo $str;
// 判断操作
} elseif ($act == "doRename") {
// 接收新名称
$newName = $_REQUEST['newName'];
// 进行修改文件名
var_dump($path);
$mes = rename_file($filename, $path . "/" . $newName);
// 提示操作
alertMes($mes, $url);
// 判断点击操作
} elseif ($act == "copyFile") {
// 制作表单
$str = <<
文件复制到:
HERE;
echo $str;
// 判断操作
} elseif ($act == "doCopyFile") {
// 接收目标目录
$destName = $_REQUEST['destName'];
// 进行复制操作
$mes = copy_file($filename, $path . "/" . $destName);
// 提示操作
alertMes($mes, $url);
} elseif ($act == "cutFile") {
$str = <<
文件剪切到:
HERE;
echo $str;
} elseif ($act == "doCutFile") {
$destName = $_REQUEST['destName'];
$mes = cut_file($filename, $path . "/" . $destName);
alertMes($mes, $url);
} elseif ($act == "dowFile") {
$mes = dow_file($filename);
} elseif ($act == "delFile") {
if (unlink($filename)) {
alertMes("文件删除成功!", $url);
} else {
alertMes("文件删除失败!", $url);
}
} elseif ($act == "上传文件") {
$fileInfo = $_FILES['myFile'];
$mes = upload_file($fileInfo, $path);
alertMes($mes, $url);
} elseif ($act == "创建文件夹") {
$mes = create_folder($path . "/" . $dirname);
alertMes($mes, $url);
} elseif ($act == "renameFolder") {
$str = <<
重命名为:
HERE;
echo $str;
} elseif ($act == "doRenameFolder") {
$newFolderName = $_REQUEST['newFolderName'];
$mes = rename_dir($dirname, $path . "/" . $newFolderName);
alertMes($mes, $url);
} elseif ($act == "copyFolder") {
$str = <<
复制为:
HERE;
echo $str;
} elseif ($act == "doCopyFolder") {
$newFolderName = $_REQUEST['newFolderName'];
$mes = copy_dir($dirname, $path . "/" . $newFolderName . "/" . basename($dirname));
alertMes($mes, $url);
} elseif ($act == "cutFolder") {
$str = <<
剪切为:
HERE;
echo $str;
} elseif ($act == "doCutFolder") {
$newFolderName = $_REQUEST['newFolderName'];
$mes = cut_dir($dirname, $path . "/" . $newFolderName);
alertMes($mes, $url);
} elseif ($act == "delFolder") {
$mes = del_folder($dirname);
alertMes($mes, $url);
}
Correcting teacher:韦小宝Correction time:2019-01-15 13:11:15
Teacher's summary:写的很不错 下次这种记得要把页面截图哦 继续加油吧