十年網(wǎng)站開發(fā)經(jīng)驗 + 多家企業(yè)客戶 + 靠譜的建站團隊
量身定制 + 運營維護+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
代碼如下:
為萬全等地區(qū)用戶提供了全套網(wǎng)頁設計制作服務,及萬全網(wǎng)站建設行業(yè)解決方案。主營業(yè)務為成都網(wǎng)站制作、成都做網(wǎng)站、外貿(mào)營銷網(wǎng)站建設、萬全網(wǎng)站設計,以傳統(tǒng)方式定制建設網(wǎng)站,并提供域名空間備案等一條龍服務,秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!
header("Content-type: text/html; charset=utf8");
/**
* 遞歸遍歷文件
* @param string $path 目錄路徑
* @param int $deep=0 當前目錄的深度
*/
function readDirs($path,$deep=0) {
// 打開一個目錄,讀取它的內(nèi)容
$dh = opendir($path);
while (false !== $file = readdir($dh)) {
// 篩選掉./和../
if ($file != "." && $file != "..") {
// 輸出文件
$tmpStr = $file.'
';
if ($deep != 0) {
$tmpStr = str_repeat(' ', $deep*2-1).'--'.$tmpStr;
}
echo $tmpStr;
// 進入遞歸點和遞歸出口
$tmpPath = $path . '/' .$file;
if (is_dir($tmpPath)) {
readDirs($tmpPath,$deep+1);
}
}
}
closedir($dh);
}
readDirs('./');
運行截圖如下: