{"id":765,"date":"2023-11-01T15:40:42","date_gmt":"2023-11-01T06:40:42","guid":{"rendered":"https:\/\/blog.mydepot.kr\/?p=765"},"modified":"2023-11-01T15:40:42","modified_gmt":"2023-11-01T06:40:42","slug":"php-%ed%8c%8c%ec%9d%bc-%ea%b2%80%ec%83%89-%ed%95%a8%ec%88%98","status":"publish","type":"post","link":"https:\/\/blog.mydepot.kr\/?p=765","title":{"rendered":"[PHP] \ud30c\uc77c \uac80\uc0c9 \ud568\uc218"},"content":{"rendered":"<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction findFilesWithDateRange(\n      $path,\n      $fileName = null,\n      $extension = null,\n      $startDate = null,\n      $endDate = null,\n      $fileTimeType = &#039;modified&#039;,\n      $maxSubdirectoryDepth = -1\n) {\n      $path = is_array($path) ? $path : &#x5B;$path];\n      $matchingFiles = &#x5B;];\n\n      foreach ($path as $dir) {\n            if (!is_dir($dir)) {\n                  continue;\n            }\n\n            $dirIterator = new RecursiveDirectoryIterator($dir);\n            $iterator = new RecursiveIteratorIterator($dirIterator);\n\n            if ($maxSubdirectoryDepth &gt;= 0) {\n                  $iterator-&gt;setMaxDepth($maxSubdirectoryDepth);\n            }\n\n            foreach ($iterator as $fileInfo) {\n                  if ($fileInfo-&gt;isFile()) {\n                        $filePath = $fileInfo-&gt;getPathname();\n                        $fileTime = ($fileTimeType == &#039;created&#039;) ? filectime($filePath) : filemtime($filePath);\n\n                        if (\n                              (is_null($fileName) || fnmatch($fileName, $fileInfo-&gt;getFilename())) &amp;amp;&amp;amp;\n                              (is_null($extension) || pathinfo($fileInfo-&gt;getFilename(), PATHINFO_EXTENSION) == $extension) &amp;amp;&amp;amp;\n                              (is_null($startDate) || $fileTime &gt;= strtotime($startDate)) &amp;amp;&amp;amp;\n                              (is_null($endDate) || $fileTime &amp;lt;= strtotime($endDate))\n                        ) {\n                              $matchingFiles&#x5B;] = $filePath;\n                        }\n                  }\n            }\n      }\n      if (count($matchingFiles) &gt; 0) {\n            return $matchingFiles;\n      } else {\n            return false;\n      }\n}\n<\/pre><\/div>\n\n\n<p>\ud30c\uc77c\uc744 \uac80\uc0c9\ud558\ub294 \ud568\uc218\uc774\ub2e4.<\/p>\n\n\n\n<p>\uacbd\ub85c, \ud30c\uc77c\uba85, \ud655\uc7a5\uc790, \uc0dd\uc131\/\uc218\uc815\uc77c, \uae4a\uc774\ub4f1\uc744 \uc124\uc815 \uac00\ub2a5\ud558\ub2e4.<\/p>\n\n\n\n<p>\ud30c\uc77c\uc774 \uc5c6\uc744 \uacbd\uc6b0 false\ub97c \ub9ac\ud134\ud55c\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ud30c\uc77c\uc744 \uac80\uc0c9\ud558\ub294 \ud568\uc218\uc774\ub2e4. \uacbd\ub85c, \ud30c\uc77c\uba85, \ud655\uc7a5\uc790, \uc0dd\uc131\/\uc218\uc815\uc77c, \uae4a\uc774\ub4f1\uc744 \uc124\uc815 \uac00\ub2a5\ud558\ub2e4. \ud30c\uc77c\uc774 \uc5c6\uc744 \uacbd\uc6b0 false\ub97c \ub9ac\ud134\ud55c\ub2e4.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[8],"tags":[23,36,82,394],"class_list":["post-765","post","type-post","status-publish","format-standard","hentry","category-php","tag-php","tag-36","tag-82","tag-394"],"modified_by":"\ucc38\ube5b\ubc14\ub2e4","_links":{"self":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts\/765","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=765"}],"version-history":[{"count":1,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts\/765\/revisions"}],"predecessor-version":[{"id":766,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=\/wp\/v2\/posts\/765\/revisions\/766"}],"wp:attachment":[{"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=765"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=765"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mydepot.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=765"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}