laravel文件存儲Storage


use Illuminate\Support\Facades\Storage;


//建立目錄
Storage::disk('public')->makeDirectory(date('Y-m'));

//存文件 public為config/filesystems.php存的配置
$bool = Storage::disk('public')->put($filename, file_get_contents($realPath));

 

$fileStr = Storage::disk('public')->get($fileName);//獲取文件內容
//獲取目錄文件,兩個返回值有差別,第一個帶public
$files = Storage::allFiles('public');
$files = Storage::disk('public')->allFiles();

 

 

可參考:https://d.laravel-china.org/docs/5.5/filesystem

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM