abstract:<!DOCTYPE html> <?php //獲取當(dāng)前目錄名
<!DOCTYPE html>
<?php
//獲取當(dāng)前目錄名
$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)){
//目錄名存在就跳轉(zhuǎn)到當(dāng)前頁面
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:完成的不錯(cuò)。目錄文件,一般用在日志和圖片上,繼續(xù)加油