Laravel 中 File::put() 存储在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40325862/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 14:40:39  来源:igfitidea点击:

Where is the File::put() stored in Laravel?

phplaravel

提问by stat.us

I have a question relating to Laravel, where is the File::put()stored in Laravel?

我有一个关于 Laravel 的问题,Laravel 中的File::put()存储在哪里?

I have checked inside storage/app/publicand the content isn't there.

我查了里面storage/app/public的内容没有。

回答by iCoders

File::putstore in publicfolder

File::put存放在public文件夹中

for example .In this case file.txt will be created in public folder

例如。在这种情况下,file.txt 将在公共文件夹中创建

File::put('file.txt', 'contents is written inside file.txt');

Also you can use Storage class

您也可以使用 Storage 类

Storage::put( 'file.txt','contents is written inside file.txt' );

This will create file inside storage\app

这将在里面创建文件 storage\app

回答by Amit Gupta

To store files in folder storage/app, you must use Storageclass as:

要将文件存储在文件夹中storage/app,您必须使用Storage类作为:

Storage::disk('local')->put('file.txt', 'Contents');

then it would store a file in storage/app/file.txt.

然后它将文件存储在storage/app/file.txt.

Docs

文档

回答by José Eduardo Rios

to make sure the location you can use the functions

确保您可以使用功能的位置

  • public_path ()
  • storage_path ()
  • app_path ()
  • 公共路径()
  • 存储路径()
  • app_path()

ex:

前任:

File::put(public_path('uploads'), $data);