".$end_of_line; // echo strlen($end_of_line).$newline; $charset="UTF-8"; $mail_addr="web@shichido.net"; $css_file="generic.css"; $text= <<< html_head $my_name back | Top

ディレクトリ内のファイル名一覧取得


html_head; // ヒアドキュメントここまで echo $text; $textext=".php"; if ($dir = opendir("./")) { while (($file = readdir($dir)) !== false) { if ($file != "." && $file != ".." && strstr($file,$textext)!==FALSE) { // echo "$file
\n"; $arr[]=$file; } // strstr() 文字列2が現れる場所を返す } closedir($dir); } $textext=".html"; if ($dir = opendir("./")) { while (($file = readdir($dir)) !== false) { if ($file != "." && $file != ".." && strstr($file,$textext)!==FALSE) { // echo "$file
\n"; $arr[]=$file; } // strstr() 文字列2が現れる場所を返す } closedir($dir); } $textext=".css"; if ($dir = opendir("./")) { while (($file = readdir($dir)) !== false) { if ($file != "." && $file != ".." && strstr($file,$textext)!==FALSE) { // echo "$file
\n"; $arr[]=$file; } // strstr() 文字列2が現れる場所を返す } closedir($dir); } sort($arr); $arrcnt = count($arr); //count() 配列の要素数を返す $fmt= <<< format_id
  • %s
  • \n format_id; // ヒアドキュメントここまで $list_type='ol'; echo "<$list_type>\n"; for ($loopc=1;$loopc<=$arrcnt;$loopc++) {printf($fmt,$arr[$loopc-1],$arr[$loopc-1]);} echo "\n"; $version=phpversion(); echo "

    [PHP $version]

    \n"; ?>