folder (including subfolders and files), take the path and file name of all the files under the folder and sub-folders with the suffix jpg, place the paths and filenames in the array

Source: Internet
Author: User
Tags glob
Calculate how many files
For loop is less than the total number of files
Take the file name and path in turn. Put in a two-dimensional array arr[0][0] put file name arr[0[1] Drop path
End of cycle


Reply to discussion (solution)

 $path [] = ' images '; for ($i =0; $i 
   
   

path is D:\tupian, where does the program add this path?


Take the jpg file under D:\tupian, and the JPG file in all subdirectories within D:\tupian

$path [] = ' D:\tupian ';

How did you learn to program? Not extrapolate?

"dirname ($v)", can this position be replaced with the absolute path with the file name?

don't know what you're talking about


$res [] = Array (dirname ($v), BA SENAME ($v));

In this sentence, dirname ($v), this path can become the path containing the file name,

contains the path of the file name, for example: D:/mulu/1.jpg Add the name of the filename

You just look at $v, you know?

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.