Hello!, the question might be simple, but i couldn't find the answer.
i want to create a .txt file with laravel 4 and upload it to my server like PHP does, and also i need to create a JSON file with laravel 4 and upload it to my server.
我想用laravel 4创建一个.txt文件,然后像PHP那样将它上传到我的服务器,同时我需要创建一个带有laravel 4的JSON文件并将其上传到我的服务器。
Thanks for your help!
谢谢你的帮助!
1 个解决方案
#1
26
To use the filesystem of Laravel, you should access it through the File
Facade.
要使用Laravel的文件系统,您应该通过File Facade访问它。
Create a new file:
创建一个新文件:
//Usage
File::put($path,$contents);
//Example
File::put('web/text/mytextdocument.txt','John Doe');
Delete a file:
删除文件:
//Usage
File::delete(string|array $paths)
//Example
File::delete('web/text/mytextdocument.txt');
The complete documentation on all available methods is found here: https://laravel.com/api/4.2/Illuminate/Filesystem/Filesystem.html
有关所有可用方法的完整文档,请访问:https://laravel.com/api/4.2/Illuminate/Filesystem/Filesystem.html
#1
26
To use the filesystem of Laravel, you should access it through the File
Facade.
要使用Laravel的文件系统,您应该通过File Facade访问它。
Create a new file:
创建一个新文件:
//Usage
File::put($path,$contents);
//Example
File::put('web/text/mytextdocument.txt','John Doe');
Delete a file:
删除文件:
//Usage
File::delete(string|array $paths)
//Example
File::delete('web/text/mytextdocument.txt');
The complete documentation on all available methods is found here: https://laravel.com/api/4.2/Illuminate/Filesystem/Filesystem.html
有关所有可用方法的完整文档,请访问:https://laravel.com/api/4.2/Illuminate/Filesystem/Filesystem.html