需求: 寫了大量的php程式,突然想找回某乙個檔案(含特定關鍵字),翻遍了虛擬目錄裡面的每乙個php檔案都沒有找到,於是寫了個指令碼去幫忙搜尋
// 例子
$filelist = array();
$dir = "e:";
$ext =".php";
$word="keyword";
findword($dir,$ext,$word);
/*功能:遍歷資料夾指定型別檔案,找到含某關鍵字檔案
輸入:$dir 目錄 , $ext 檔案字尾, $word 關鍵字
輸出:檔案list
*/function findword($dir,$ext,$word)
}print_r($rlist);}/*
遍歷某個目錄下的所有檔案和子資料夾,返回某個字尾的檔案列表;
*/function read_all_dir ( $dir )
else}}
}closedir($handle);
}//return $result;
return $filelist;
}
poweshell批量刪除某型別檔案
rm o recurse 按照提示,rm remove item 是可以遞迴刪除子資料夾的。但是這個方法確實無效。在他們的示例裡面找到說明 示例 4 c ps get childitem include csv recurse remove item 說明 此命令將以遞迴方式刪除當前目錄及其所有子目...
PHP 包含檔案
include include once require require once include 和 require 除了處理錯誤的方式不同之外,在其他方面都是相同的 require如果引入的檔案不存在,生成乙個致命錯誤,在錯誤發生後指令碼會停止執行。include如果引入的檔案不存在,生成乙個警...
php檔案包含
小型 網頁也都得有數十個,因此關頁面的 量會很大,為了節省頻寬等諸多優化問題,要盡量實現頁面的復用 include,include once,require,require once 乙個模組可能有10來個介面 header content type text html charset utf 8 ...