3
對於php來說是新鮮事物,所以請耐心等待。我想弄清楚如何讀取一個目錄/文件夾,並將文件名/路徑和文件的標題返回給li。如何從html文件中使用目錄獲得標題 - php
$handle = opendir('.');
while (false !== ($file = readdir($handle))){
$extension = strtolower(substr(strrchr($filename, '.'), 1));
if($extension == 'html' || $extension == 'htm' || $extension == 'php'){
echo "<a href='".$filename."'><li class='"iso_block"'><span>"**Title Tag Here**"</span></li></a>";
}
}
^從米羅代碼(歡呼聲/感謝)
js.Fiddle鏈接視覺:[`glob`] http://jsfiddle.net/AagGZ/547/
你嘗試過(http://php.net /manual/en/function.glob.php)? –
在dom中加載文件並搜索標題標籤(慢)或preg_match(「#
jsFiddle for testing php?你想要達到什麼樣的人? –