search

Home  >  Q&A  >  body text

Iterate through all files in a directory

How to traverse all files in a directory?

Get their file names.

Requires compatibility with Win and Linux systems

phpphp1174 days ago985

reply all(4)I'll reply

  • A _ Q _i_

    A _ Q _i_2021-10-12 20:54:00

    You need to write a recursive function, and then you can get it done

    reply
    1
  • autoload

    autoload2021-10-09 10:43:34

    Use dirname(__FILE__) to get the upper-level directory of the current file, and then scandir()

    reply
    0
  • Cancelreply