[原創]php+ajax實現類比Win檔案管理系統二_PHP教程

來源:互聯網
上載者:User
[原創]php+ajax實現類比Win檔案管理系統

//本教程由本站原創,轉載請註明來處

作者: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....

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.