主页面:
<?php session_start(); $filename=""; if(!empty($_SESSION["lujing"])) { $filename = $_SESSION["lujing"]; $sj = dirname($_SESSION["lujing"]);//找上级目录 echo "<div id='prev' class='list' lj='{$sj}'>返回上一层</div>"; } else { $filename = "./bootstrap"; } ?> <div id="nr"> <?php //打开该文件夹 $dir = opendir($filename); while($f = readdir($dir)) { if($f!="." && $f!="..") { $ml = $filename."/".$f; if(is_file($filename."/".$f)) { echo "<div class='list'>{$f}</div>"; } else { echo "<div lj='{$ml}' class='list mulu'>{$f}</div>"; } } } closedir($dir); ?> </div> </div> <script type="text/javascript"> $(".mulu").dblclick(function(){ var lj = $(this).attr("lj"); $.ajax({ url:"chuli.php", data:{lj:lj}, type:"POST", dataType:"TEXT", success: function(){ window.location.href="xiugai.php"; } }); }) $("#prev").dblclick(function(){ var lj = $(this).attr("lj"); $.ajax({ url:"chuli.php", data:{lj:lj}, type:"POST", dataType:"TEXT", success: function(){ window.location.href="xiugai.php"; } }); }) </script>
处理页面:
session_start(); $lj = $_POST["lj"]; $_SESSION["lujing"] = $lj;