language:php:php_파일_디렉토리
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
language:php:php_파일_디렉토리 [2021/05/29 13:08] – 만듦 kieuns | language:php:php_파일_디렉토리 [2024/04/23 22:44] (현재) – 바깥 편집 127.0.0.1 | ||
---|---|---|---|
줄 63: | 줄 63: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | |||
+ | ====== 코드 조각 ====== | ||
+ | |||
+ | ===== 파일, | ||
+ | |||
+ | <code php> | ||
+ | // $start_dir_ (폴더명, (예, ' | ||
+ | // 저장 형식 (리턴할 배열의 저장 형식) | ||
+ | // > array( array(' | ||
+ | // > ' | ||
+ | // > ' | ||
+ | function get_dir_from($start_dir_) | ||
+ | { | ||
+ | $ar_for_sav_ = []; | ||
+ | $_idx = 0; | ||
+ | if ($handle = opendir($start_dir_)) | ||
+ | { | ||
+ | while (false !== ($entry = readdir($handle))) | ||
+ | { | ||
+ | if (is_dir($entry) && ($entry != ' | ||
+ | { | ||
+ | $ar_for_sav_[$_idx] = [' | ||
+ | // | ||
+ | $_idx++; | ||
+ | } | ||
+ | elseif (is_file($entry)) | ||
+ | { | ||
+ | // 파일 확장자 얻기 | ||
+ | $path_info = pathinfo($entry); | ||
+ | $ar_ext = [' | ||
+ | // 확장자가 $ar_ext 에 포함 되어 있다면 | ||
+ | if (in_array($path_info[' | ||
+ | { | ||
+ | $ar_for_sav_[$_idx] = [' | ||
+ | // | ||
+ | $_idx++; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | closedir($handle); | ||
+ | } | ||
+ | return $ar_for_sav_; | ||
+ | } | ||
+ | </ |
language/php/php_파일_디렉토리.1622261308.txt.gz · 마지막으로 수정됨: 2024/04/23 22:43 (바깥 편집)