开发者

PHP + Wordpress - get a list of files from a directory [duplicate]

This question already has answers here: Closed 10 years ago.

Possible Duplicate:

Best way to get files from a dir filtered by certain extension in php

Are there any native WP functions that are able to list files based by extension from a directory? if not, how do I do this with php?

I want to get the file names 开发者_如何学运维of all .css files from a certain folder


Use glob like so:

$file_paths = glob('/path/to/files/*.extension');


I don't know about wordpress

But in PHP, you want the glob command - http://php.net/glob


Check out the glob function

$files=glob("/path/to/your/folder/*.css");
foreach ($files as $file) {
    echo "$file<br>";
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜