1. <i id='UNdyX'><tr id='UNdyX'><dt id='UNdyX'><q id='UNdyX'><span id='UNdyX'><b id='UNdyX'><form id='UNdyX'><ins id='UNdyX'></ins><ul id='UNdyX'></ul><sub id='UNdyX'></sub></form><legend id='UNdyX'></legend><bdo id='UNdyX'><pre id='UNdyX'><center id='UNdyX'></center></pre></bdo></b><th id='UNdyX'></th></span></q></dt></tr></i><div id='UNdyX'><tfoot id='UNdyX'></tfoot><dl id='UNdyX'><fieldset id='UNdyX'></fieldset></dl></div>
  2. <tfoot id='UNdyX'></tfoot>

      <small id='UNdyX'></small><noframes id='UNdyX'>

      • <bdo id='UNdyX'></bdo><ul id='UNdyX'></ul>
      <legend id='UNdyX'><style id='UNdyX'><dir id='UNdyX'><q id='UNdyX'></q></dir></style></legend>

      目录中每个文件的循环代码

      时间:2023-07-15
          <tbody id='Gpezn'></tbody>

            • <bdo id='Gpezn'></bdo><ul id='Gpezn'></ul>
              <legend id='Gpezn'><style id='Gpezn'><dir id='Gpezn'><q id='Gpezn'></q></dir></style></legend>
            • <small id='Gpezn'></small><noframes id='Gpezn'>

              <tfoot id='Gpezn'></tfoot>
                <i id='Gpezn'><tr id='Gpezn'><dt id='Gpezn'><q id='Gpezn'><span id='Gpezn'><b id='Gpezn'><form id='Gpezn'><ins id='Gpezn'></ins><ul id='Gpezn'></ul><sub id='Gpezn'></sub></form><legend id='Gpezn'></legend><bdo id='Gpezn'><pre id='Gpezn'><center id='Gpezn'></center></pre></bdo></b><th id='Gpezn'></th></span></q></dt></tr></i><div id='Gpezn'><tfoot id='Gpezn'></tfoot><dl id='Gpezn'><fieldset id='Gpezn'></fieldset></dl></div>
                本文介绍了目录中每个文件的循环代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个图片目录,我想遍历它并对其进行一些文件计算.可能只是睡眠不足,但我如何使用 PHP 查看给定目录,并使用某种 for 循环遍历每个文件?

                I have a directory of pictures that I want to loop through and do some file calculations on. It might just be lack of sleep, but how would I use PHP to look in a given directory, and loop through each file using some sort of for loop?

                谢谢!

                推荐答案

                scandir:

                $files = scandir('folder/');
                foreach($files as $file) {
                  //do your work here
                }
                

                或 glob 可能更适合您的需求:

                or glob may be even better for your needs:

                $files = glob('folder/*.{jpg,png,gif}', GLOB_BRACE);
                foreach($files as $file) {
                  //do your work here
                }
                

                这篇关于目录中每个文件的循环代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:php创建没有zip文件路径的zip文件 下一篇:在我的 index.php 中加载 CSS 和 JS 等资源时出现错误 403

                相关文章

                  <bdo id='JqFNi'></bdo><ul id='JqFNi'></ul>

                  <i id='JqFNi'><tr id='JqFNi'><dt id='JqFNi'><q id='JqFNi'><span id='JqFNi'><b id='JqFNi'><form id='JqFNi'><ins id='JqFNi'></ins><ul id='JqFNi'></ul><sub id='JqFNi'></sub></form><legend id='JqFNi'></legend><bdo id='JqFNi'><pre id='JqFNi'><center id='JqFNi'></center></pre></bdo></b><th id='JqFNi'></th></span></q></dt></tr></i><div id='JqFNi'><tfoot id='JqFNi'></tfoot><dl id='JqFNi'><fieldset id='JqFNi'></fieldset></dl></div>

                  <small id='JqFNi'></small><noframes id='JqFNi'>

                  <tfoot id='JqFNi'></tfoot>

                1. <legend id='JqFNi'><style id='JqFNi'><dir id='JqFNi'><q id='JqFNi'></q></dir></style></legend>