01.
<?php
02.
session_cache_limiter(
'nocache'
);
03.
session_start();
04.
05.
header(
"Content-Type: text/html; charset=utf-8"
);
06.
07.
print
"<pre>"
;
08.
print_r( recursionFiles(
realpath
(
"./"
) ) );
09.
print
"</pre>"
;
10.
11.
12.
13.
14.
15.
function
recursionFiles(
$target
) {
16.
17.
18.
$files
=
glob
(
"{$target}/*"
);
19.
20.
21.
$result
=
array
();
22.
23.
foreach
(
$files
as
$file
) {
24.
25.
if
(
is_file
(
$file
)) {
26.
27.
$result
[] =
$file
;
28.
}
29.
30.
else
{
31.
32.
$result
=
array_merge
(
$result
, recursionFiles(
$file
));
33.
}
34.
}
35.
36.
return
$result
;
37.
}
38.
39.
40.
41.
?>