图片管理

<html>
<head>
<script language="javascript">
window.location ="#bottom";//自动跳转到锚点处
</script>
<style>
.button {
    display: inline-block;
    position: relative;
    margin: 10px;
    padding: 0 20px;
    text-align: center;
    text-decoration: none;
    text-shadow: 1px 1px 1px rgba(255,255,255,.22);
    font: bold 12px/25px Arial, sans-serif;

    -webkit-border-radius: 30px;
    -moz-border-radius: 30px;
    border-radius: 30px;

    -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,.29), inset 1px 1px 1px rgba(255,255,255,.44);
    -moz-box-shadow: 1px 1px 1px rgba(0,0,0,.29), inset 1px 1px 1px rgba(255,255,255,.44);
    box-shadow: 1px 1px 1px rgba(0,0,0,.29), inset 1px 1px 1px rgba(255,255,255,.44);

    -webkit-transition: all 0.15s ease;
    -moz-transition: all 0.15s ease;
    -o-transition: all 0.15s ease;
    -ms-transition: all 0.15s ease;
    transition: all 0.15s ease;
}
.button:hover {
        -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,.29), inset 0px 0px 2px rgba(0,0,0, .5);
        -moz-box-shadow: 1px 1px 1px rgba(0,0,0,.29), inset 0px 0px 2px rgba(0,0,0, .5);
        box-shadow: 1px 1px 1px rgba(0,0,0,.29), inset 0px 0px 2px rgba(0,0,0, .5);
    }

    .button:active {
        -webkit-box-shadow: inset 0px 0px 3px rgba(0,0,0, .8);
        -moz-box-shadow: inset 0px 0px 3px rgba(0,0,0, .8);
        box-shadow: inset 0px 0px 3px rgba(0,0,0, .8);
    }
.xf{
position: fixed; /*IE6以外的兼容*/

_position:absolute;/*兼容IE6的代码*/
_bottom:auto;/*兼容IE6的代码*/
_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0))); /*兼容IE6的代码*/

border: 2px solid #4AA700; /* 其余显示代码 */
display: block; 
z-index: 999;
width: 30px; 
bottom: 0px; right: 0px;
background:#FFF;
padding:10px;
}
.xf2{
position: fixed; /*IE6以外的兼容*/

_position:absolute;/*兼容IE6的代码*/
_bottom:auto;/*兼容IE6的代码*/
_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0))); /*兼容IE6的代码*/

border: 2px solid #4AA700; /* 其余显示代码 */
display: block; 
z-index: 999;
width: 30px; 
bottom: 100px; right: 0px;
background:#FFF;
padding:10px;
}
</style>
<title>图片管理</title>
</head>
<body>

<?php 
$img = array('gif','png','jpg');//所有图片的后缀名
$dir = 'phpuploadimage**.'; 
foreach($img as $k=>$v)//$img是数组 $_k是键 $_v是值 这是一种遍历数组的简便方法 那个变量代表k/v对的中的key,那个变量可以用来表示value
{
    $file = $dir.$v;
    foreach (glob("$file") as $filename) 
 {
 
     echo "<div  style='border-style:dashed;' class='button'>";
     echo "<img src="".$filename."">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
     echo "<form name='input' action='del.php' method='post'>";
     //echo "目标文件夹路径:<input type='text' name='dir' value='$file'/>"; //出错的原因在于$file,而是$filename 
     echo "<input type='text' name='dir' value='$filename' class='button'>"; //type='submit'的话不会post出值的。。。
     echo "<input type='submit' value='删除' class='button'/>";
     echo "</form>";
     echo"</div>";
}
}
?> 

<?php
error_reporting(0); 
$yourpost=$_POST['dir'];
echo $yourpost;
?>


<a href="#" class="xf button">老旧照片</a>
<a href="#bottom" class="xf2 button" >最新照片</a>
<a name="bottom"></a>    
</body>
</html>
<?php 
$img = array('gif','png','jpg');//所有图片的后缀名
$dir = 'phpuploadimage**.'; 
foreach($img as $k=>$v)//$img是数组 $_k是键 $_v是值 这是一种遍历数组的简便方法 那个变量代表k/v对的中的key,那个变量可以用来表示value
{
    $file = $dir.$v;
    foreach (glob("$file") as $filename) 
 {
    
     echo "<input type='text' name='dir' value='$filename'>"; //type='submit'的话不会post出值的。。。
    
 }
}
?> 


<?php
$file = $_POST['dir'];
unlink($file);
echo"<script> window.location.replace('tp.php'); </script>";//window.location.href="url"; 重定向到页面,会产生新的历史记录  
//window.location.replace("http://www.skycn.com");装入指定 URL 的文档替换当前文档。原网页历史记录将不存在
?>
原文地址:https://www.cnblogs.com/hellowzd/p/4129680.html