| Revision 20119,
671 bytes
checked in by nanasess, 15 years ago
(diff) |
|
module 以下は svn:keywords を除外
|
-
Property svn:eol-style set to
LF
|
| Line | |
|---|
| 1 | --TEST-- |
|---|
| 2 | Function -- scandir |
|---|
| 3 | --SKIPIF-- |
|---|
| 4 | <?php if (function_exists('scandir')) { echo 'skip'; } ?> |
|---|
| 5 | --FILE-- |
|---|
| 6 | <?php |
|---|
| 7 | require_once 'PHP/Compat.php'; |
|---|
| 8 | PHP_Compat::loadFunction('scandir'); |
|---|
| 9 | |
|---|
| 10 | // Create a folder and fill it with files |
|---|
| 11 | mkdir('tmp'); |
|---|
| 12 | touch('tmp/test1'); |
|---|
| 13 | touch('tmp/test2'); |
|---|
| 14 | |
|---|
| 15 | // Scan it |
|---|
| 16 | $dir = 'tmp'; |
|---|
| 17 | // Not sorted |
|---|
| 18 | $files = scandir($dir); |
|---|
| 19 | // Sorted |
|---|
| 20 | $files2 = scandir($dir, 1); |
|---|
| 21 | |
|---|
| 22 | // List the results |
|---|
| 23 | print_r($files); |
|---|
| 24 | print_r($files2); |
|---|
| 25 | |
|---|
| 26 | // Remove the files |
|---|
| 27 | unlink('tmp/test1'); |
|---|
| 28 | unlink('tmp/test2'); |
|---|
| 29 | rmdir('tmp'); |
|---|
| 30 | ?> |
|---|
| 31 | --EXPECT-- |
|---|
| 32 | Array |
|---|
| 33 | ( |
|---|
| 34 | [0] => . |
|---|
| 35 | [1] => .. |
|---|
| 36 | [2] => test1 |
|---|
| 37 | [3] => test2 |
|---|
| 38 | ) |
|---|
| 39 | Array |
|---|
| 40 | ( |
|---|
| 41 | [0] => test2 |
|---|
| 42 | [1] => test1 |
|---|
| 43 | [2] => .. |
|---|
| 44 | [3] => . |
|---|
| 45 | ) |
|---|
Note: See
TracBrowser
for help on using the repository browser.