第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

文件管理類(暫時(shí)只寫了讀取,因?yàn)椴恢涝陧?xiàng)目中在哪里使用)

<?php
/*****************
*????fileOnLineManager.class.php
*????文件在線管理類
*
*****************/
class?FileOnLineManager{
????private?$path;//指定管理的目錄

????public?function?__construct($var_path){
????????$this->path=$var_path;
????}
????
????/*
????*????@function?獲得文件及目錄列表
????*????@param?string?$path?指定目錄
????*????@return?array
????*/
????public?function?getFileAndDirectory($path){
????????$resource=opendir($path);
????????$arr=array();
????????while(($item=readdir($resource))!==false){
????????????if($item!="."?&&?$item!=".."){
????????????????if(is_dir($path."/".$item)){
????????????????????//$arr["dir"][]=$item;
????????????????????$var_dir_pathname=$path."/".$item;
????????????????????$row["name"]=$item;
????????????????????$row["type"]=$this->getFileType($var_dir_pathname);
????????????????????$row["size"]=$this->getDirectorySize($var_dir_pathname);
????????????????????$row["is_readable"]=$this->getFileReadable($var_dir_pathname);
????????????????????$row["is_writeable"]=$this->getFileWriteable($var_dir_pathname);
????????????????????$row["is_executable"]=$this->getFileExecutable($var_dir_pathname);
????????????????????$row["ct"]=$this->getFileCtTime($var_dir_pathname);
????????????????????$row["mt"]=$this->getFileMtTime($var_dir_pathname);
????????????????????$row["at"]=$this->getFileATime($var_dir_pathname);
????????????????????$arr[]=$row;
????????????????}
????????????????if(is_file($path."/".$item)){
????????????????????//$arr["file"][]=$item;
????????????????????$var_file_pathname=$path."/".$item;
????????????????????$row["name"]=$item;
????????????????????$row["type"]=$this->getFileType($var_file_pathname);
????????????????????$row["size"]=$this->getFileSize($var_file_pathname);
????????????????????$row["is_readable"]=$this->getFileReadable($var_file_pathname);
????????????????????$row["is_writeable"]=$this->getFileWriteable($var_file_pathname);
????????????????????$row["is_executable"]=$this->getFileExecutable($var_file_pathname);
????????????????????$row["ct"]=$this->getFileCtTime($var_file_pathname);
????????????????????$row["mt"]=$this->getFileMtTime($var_file_pathname);
????????????????????$row["at"]=$this->getFileATime($var_file_pathname);
????????????????????$arr[]=$row;
????????????????}
????????????}
????????}
????????closedir($resource);
????????return?$arr;
????}

????/*
????*????@function?獲取文件類型
????*/
????public?function?getFileType($var_file_pathname){
????????return?filetype($var_file_pathname);
????}
????
????/*
????*????@function?獲得文件大小
????*????@param?string?$var_file_pathname?文件的完整路徑名
????*????@return?string
????*/
????public?function?getFileSize($var_file_pathname){
????????$size=filesize($var_file_pathname);
????????return?$this->transSize($size);
????}
????
????/*
????*????@function?轉(zhuǎn)換文件大小單位
????*????@param?int?$var_size
????*????@return?string
????*/
????public?function?transSize($var_size){
????????$size=$var_size;
????????$row=array("byte","KB","MB","GB","TB");
????????$i=0;
????????while($size>=1024){
????????????$size=$size/1024;
????????????$i++;
????????}
????????$result=round($size,2).$row[$i];
????????return?$result;
????}

????/*
????*????@function?獲得文件是否可讀
????*????@param?string?$var_file_pathname
????*????@return?boolean?返回true表示可讀,false表示不可讀
????*/
????public?function?getFileReadable($var_file_pathname){
????????if(is_readable($var_file_pathname)){
????????????return?true;
????????}
????????else{
????????????return?false;
????????}
????}

????/*
????*????@function?獲得文件是否可寫
????*????@param?string?$var_file_pathname
????*????@return?boolean?返回true表示可寫,false表示不可寫
????*/
????public?function?getFileWriteable($var_file_pathname){
????????if(is_writeable($var_file_pathname)){
????????????return?true;
????????}
????????else{
????????????return?false;
????????}
????}
????
????/*
????*????@function?獲得文件是否可執(zhí)行
????*????@param?string?$var_file_pathname
????*????@return?boolean?返回true表示可執(zhí)行,false表示不可執(zhí)行
????*/
????public?function?getFileExecutable($var_file_pathname){
????????if(is_executable($var_file_pathname)){
????????????return?true;
????????}
????????else{
????????????return?false;
????????}
????}

????/*
????*????@function?獲得文件inode的修改時(shí)間
????*????@param?string?$var_file_pathname
????*????@return?int|false?返回int時(shí)間戳,返回false表示獲取失敗
????*/
????public?function?getFileCtTime($var_file_pathname){
????????return?filectime($var_file_pathname);
????}

????/*
????*????@function?獲得文件修改時(shí)間
????*????@param?string?$var_file_pathname
????*????@return?int|false?返回int時(shí)間戳,返回false表示獲取失敗
????*/
????public?function?getFileMtTime($var_file_pathname){
????????return?filemtime($var_file_pathname);
????}

????/*
????*????@function?獲得文件的訪問時(shí)間
????*????@param?string?$var_file_pathname
????*????@return?int|false?返回int時(shí)間戳,返回false表示獲取失敗
????*/
????public?function?getFileATime($var_file_pathname){
????????return?fileatime($var_file_pathname);
????}

????/*
????*????@function?獲取目錄大小
????*????@param?string?$var_dir_pathname
????*????@return?string
????*/
????public?function?getDirectorySize($var_dir_pathname){
????????$sum=0;
????????global?$sum;
????????$handler=opendir($var_dir_pathname);
????????while(($item=readdir($handler))!==false){
????????????if($item!="."?&&?$item!=".."){
????????????????if(is_dir($var_dir_pathname."/".$item)){
????????????????????$this->getDirectroySize($var_dir_pathname."/".$item);
????????????????}
????????????????if(is_file($var_dir_pathname."/".$item)){
????????????????????$sum+=filesize($var_dir_pathname."/".$item);
????????????????}
????????????}
????????}
????????closedir($handler);
????????return?$this->transSize($sum);
????}
}
$path="./file";
$fileOnLineManager=new?FileOnLineManager($path);
$result=$fileOnLineManager->getFileAndDirectory($path);
print_r($result);
?>


正在回答

1 回答

像一些二次開發(fā)系統(tǒng)中就很常見,可以通過web的形式修改源代碼,管理項(xiàng)目中的文件

^-^...

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

微笑de迪妮莎 提問者

呵呵,我沒有二次開發(fā)系統(tǒng)的經(jīng)驗(yàn),現(xiàn)在做的項(xiàng)目是在局域網(wǎng)里通過Svn進(jìn)行管理。?謝謝,king老師
2015-03-02 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

文件管理類(暫時(shí)只寫了讀取,因?yàn)椴恢涝陧?xiàng)目中在哪里使用)

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)