我认为这对你的任务应该足够了。
来自laravel docs:
https://laravel.com/docs/5.7/filesystem#storing-files
https://laravel.com/docs/5.7/filesystem#retrieving-files
@Aleksandrs回答后我发现了。问题解决了。
我做了类似的事。
public function downloadXml($filename = '') { $fields = ['created_at', 'updated_at']; $products = Product::where('user_id', auth()->id())->exclude($fields)->get()->toArray(); $products = array_collapse($products); // dd($products); $result = ArrayToXml::convert($products, 'product'); Storage::put(auth()->id().'File/products.xml', $result); }