//↑2行目は必ず空行にする。
//↓自分自身のファイル名取得。__FILE__でフルパス、basenameがファイル名のみ
$my_name=__FILE__;
$my_name=basename($my_name);
if (! ($fp = fopen ( $my_name, "r" ))) {
die("NotFound");}
fgets ($fp, 16384); //1行目を空読み
$end_of_line= fgets ($fp, 16384);
$newline="
".$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 "$list_type>\n";
$version=phpversion();
echo "[PHP $version]
\n";
?>
U