少于1分钟
将以下英文翻译为中文:
https://gohugo.io/functions/readdir/
Returns an array of FileInfo structures sorted by filename, one element for each directory entry.
os.ReadDir PATH
readDir PATH
The os.ReadDir
function resolves the path relative to the root of your project directory. A leading path separator (/
) is optional.
With this directory structure:
|
|
This template code:
|
|
Produces:
|
|
Note that os.ReadDir
is not recursive.
Details of the FileInfo
structure are available in the Go documentation.
For more information on using readDir
and readFile
in your templates, see Local File Templates.