-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathget.php
35 lines (27 loc) · 806 Bytes
/
get.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
header("Content-type: application/javascript; charset=UTF-8");
header("Access-Control-Allow-Origin: *");
$dir = $_GET['file'];
if(!is_dir($dir)) {
if($file_contents = file_get_contents($dir)) {
echo $file_contents;
} else {
echo 'dir error';
}
die;
}
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::CHILD_FIRST);
foreach ($iterator as $path) {
if(!$path->isDir()) {
if(substr($path->__toString(), -2) == 'js') {
// echo "//";
// echo $path->__toString();
// echo "\n";
// readfile($path->__toString());
$files[$path->__toString()] = file_get_contents($path->__toString());
}
}
}
ksort($files);
echo implode('', $files);
// EOF