|
<?php
function navbar(){
$files = dir("."); //指定目錄
$pipe = " | "; //管道符
//通過以下的循環搜索目錄中所有文件
while ($current = $files->read()) {
//ignor all files not of htm type.
if (strpos($current, "php")!= FALSE) //設定后綴為php的文件將被導航
//忽略自己(如 index.html)
{ if (strpos($current, "ndex") == FALSE)
{
print "<a href='";
print $current;
print "'>";
print $current;
print "</a>";
print $pipe;
};
};
};
};
navbar() //調用函數
?>
php技術:非常好的目錄導航文件代碼,轉載需保留來源!
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。