简体   繁体   中英

PHP - display directories using set of names from text file

There are more than 5 folders in the 'central' folder but I want to display only these 3 folders listed in this text file.

  • <\/li>
  • <\/li>
  • <\/li><\/ul>

    Get the names:

    "

I was not clear with my objective but here's the solution.

$getname = file(foldername.txt); // contains the folder names
$implodegetname = implode(",",$getname); //array to string
    
$folder = glob('C:\xampp\htdocs\mysite\central/*{{$implodegetname}}', GLOB_ONLYDIR);
array_multisort(
array_map( 'filemtime', $folder ),
SORT_NUMERIC,
SORT_DESC,
$folder
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM