01.
<?php
02.
session_cache_limiter(
'nocache'
);
03.
session_start();
04.
05.
header(
"Content-Type: text/html; charset=utf-8"
);
06.
?>
07.
<!DOCTYPE html>
08.
<html lang=
"ja"
>
09.
<head>
10.
<meta content=
"width=device-width initial-scale=1.0 minimum-scale=1.0 maximum-scale=1.0 user-scalable=no"
name=
"viewport"
>
11.
<meta charset=
"utf-8"
>
12.
<title>list2.php</title>
13.
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"
></script>
14.
<link rel=
"stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css"
>
15.
</head>
16.
<body>
17.
<ul>
18.
<?php recursionFiles(
realpath
(
"./"
) ) ?>
19.
</ul>
20.
</body>
21.
</html>
22.
<?php
23.
24.
25.
26.
27.
function
recursionFiles(
$target
) {
28.
29.
30.
$files
=
glob
(
"{$target}/*"
);
31.
32.
foreach
(
$files
as
$file
) {
33.
34.
if
(
is_file
(
$file
)) {
35.
36.
print
"<li>{$file}</li>"
;
37.
}
38.
39.
else
{
40.
print
"<li>{$file}</li>"
;
41.
print
"<UL>"
;
42.
43.
recursionFiles(
$file
);
44.
print
"</UL>"
;
45.
}
46.
}
47.
}
48.
49.
50.
51.
?>