LoginSignup
4
7

More than 3 years have passed since last update.

laravel フォルダの中身を一覧取得

Posted at

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


}

以上

4
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
7