0
而不是傳統的導航,我試圖模擬終端導航,或者你如何使用vim進行導航。 例子:使用php瀏覽本地目錄和文件
..
index
otherfile
這是我的代碼:
$dir = realpath(dirname(__FILE__));
if(is_dir($dir)){
if($open = opendir($dir)){
while(($file = readdir($open)) !==false){
if(is_dir($file)){
if($file == '.'){ }
else{
echo "<a href=".$file.">".$file."</a><br/>";
}
}
else{
$name = explode('.php',$file);
echo "<a href=".$file.">".$name[0]."</a><br/>";
}
}
}
}
else{
echo $dir." Was not found";
}
}
如何刪除我從列表我在文件或文件夾?例如,如果我在index.php頁面上,它仍然出現在列表中。
我想給他們一個數字例子'1file.php''2anotherfile.php'.. 如何排序他們的數字,然後刪除數字和'.php',最後打印出來?
如果你覺得重構的東西,請這樣做......
你可以添加你正在尋找的示例輸出到你的問題,這不是很清楚。 –
是的,檢查問題的頂部,它說的例子... –
我認爲你可以使用PHP的DirectoryIterator,檢查一些例子:http://www.php.net/manual/en/directoryiterator。 next.php –