How to create a text file and a JSON with laravel 4 framework?
41,579
To use the filesystem of Laravel, you should access it through the 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
Author by
Rodrigo Calix
I'm a web developer, interested in open source code, and also i make HTML Templates! Javascript fan!
Updated on August 04, 2020Comments
-
Rodrigo Calix over 3 years
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.
Thanks for your help!