abstract:<!DOCTYPE html> <?php //获取当前目录名
<!DOCTYPE html>
<?php
//获取当前目录名
$dir = opendir(__DIR__);
?>
<html>
<head>
<title>create dir</title>
<style type="text/css">
*{margin:0;padding: 0;}
div{margin: 30px auto;width: 400px;}
input{margin: 0 10px;}
</style>
</head>
<body>
<div>
<form action="dir.php" method="post">
<p>请输入文件夹名:<input type="text" name="floder"><input type="submit" name="submit"></p>
</form>
</div>
<hr>
<div>
<?php
while ($item = readdir($dir)) {
echo '<p>'.$item.'<br></p>';
}
?>
</div>
</body>
<?php
//获取请求的文件名
@$floder = $_REQUEST['floder'];
//未填文件名,不操作
if(!empty($floder)){
//目录名存在就跳转到当前页面
if(is_dir($floder)){
echo "<script>alert('目录已存在!');location.href='dir.php';</script>";
return;
}else{
mkdir($floder);
header('location:dir.php');
}
}
?>
</html>
Correcting teacher:查无此人Correction time:2019-10-12 16:27:04
Teacher's summary:完成的不错。目录文件,一般用在日志和图片上,继续加油