laravelを使って、指定したフォルダの一覧を表示したい。
ファイルを resources 以下に置けば非公開になる。
今回は /resources/sass/ のファイル一覧を取得する。
HogeController.php
$path= resource_path('sass');///var/www/html/mama-rich.net/resources/sass
$files = \File::files($path);
foreach ($files as $v) {
print_r($v->getfileName());//app.scss
print_r($v->getpathName());///var/www/html/mama-rich.net/resources/sass/app.scss
}
以上