时间:2021-07-01 10:21:17 帮助过:13人阅读
//本教程由本站原创,转载请注明来处
作者:www.drise.cn
邮箱:drise@163.com
QQ:271728967//
接上面我们来看dir.php文件代码:
$dir_path=isset($_GET['url'])?$_GET['url']:'..';
//$totallen = strlen($dir_path);
//$sublen = strlen(substr($dir_path,strrpos($dir_path,"/")));
$lastdir = substr($dir_path,0,strlen($dir_path)-strlen(substr($dir_path,strrpos($dir_path,"/"))));
Tool($dir_path,$lastdir);
CheckDir($dir_path);
//echo "
";
//echo substr($dir_path,0,(strlen($dir_path)-strrpos($dir_path,"/")+1));
function CheckDir($dir_path){// 这个函数是检查并显示当前目录下的文件及文件
if(is_dir($dir_path)){
if($dir_file=opendir($dir_path)){
while(($dir_list=readdir($dir_file))!==false)
{
if($dir_list!="." && $dir_list!=".."){//如果加这里判断等一在显示文件列表时.. .这样.
echo("
".$dir_list."
\n");
}
}
}else{
echo($dir_path."
");
}
}else{
echo($dir_path."
");
}
Folderexp($dir_path);
}
function Getfiletype($dir){//根据扩展名显示相应的图片
global $_GET;
if(@$_GET['url'] !='' and is_dir(@$_GET['url'])){
$dir = $_GET['url'].'\\'.$dir;
}
//print_r( $dir);
if($dir == '' || is_null($dir) || empty($dir)){return false;}
if(is_dir($dir)){
return 'fold.jpg';
}else{
return (Getextends($dir));
}
}
function Getextends($dir){
if($dir =="" || is_null($dir)){return "unkown.jpg";}
$Extends_name = substr($dir,strrpos($dir,".")+1);
$Extends_img = array('jpg','jpeg','gif','png','bmp','psd');
if(in_array($Extends_name,$Extends_img)){return $dir;}
switch($Extends_name){
case "php":
return 'image/asp_php_jsp.jpg';
break;
case "asp":
return 'image/asp_php_jsp.jpg';
break;
case "jsp":
return 'image/asp_php_jsp.jpg';
break;
case "aspx":
return 'image/asp_php_jsp.jpg';
break;
case "xml":
return 'image/asp_php_jsp.jpg';
break;
case "htm":
return 'image/html_js.jpg';
break;
case "html":
return 'image/html_js.jpg';
break;
case "shtml":
return 'image/html_js.jpg';
break;
case "js":
return 'image/html_js.jpg';
break;
case "txt":
return 'image/txt.jpg';
break;
case "doc":
return 'image/word.jpg';
break;
default:
return 'image/fold.jpg';
}
}
function Folderexp($dir_path){//新建文件夹
echo("");
echo("");
echo("");
echo("
");
echo("");
echo("
echo("");
}
function Tool($dir_path,$lastdir){//这里显示菜单条
echo("");
echo("");
echo("");
echo("");
echo("");
echo("");
echo("");
echo("");
echo("");
echo("");
}
?>
上一篇
http://www.bkjia.com/PHPjc/631855.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/631855.htmlTechArticle[原创]php+ajax实现模拟Win文件管理系统 //本教程由本站原创,转载请注明来处 作者:www.drise.cn 邮箱:drise@163.com QQ:271728967// 接上面我们来看dir....