0

I was reading Laravel documentation, and came across the following example which I didn't quite understand:

use Illuminate\Support\Facades\Storage;

Storage::put('file.jpg', $contents);

Storage::put('file.jpg', $resource);

I understand that the arg1 is the path of file or directory and the arg2 is the content to be written into file or file to be saved into directory. However, I don't quite understand the PHP resource here. Is there anything I could use the PHP recourse on a jpg file? Or the document actually means that I could save a PHP resource into the directory, but it just misplaced a jpg example instead of directory?

Anyone could help will be so much appreciated.

2
  • A resource can be a reference to an opened jpeg file. Maybe reading about resources would help you understand. php.net/manual/en/language.types.resource.php | check this as well: stackoverflow.com/questions/8814364/… Commented Jan 8, 2021 at 8:34
  • @user3532758 Hey! Thanks for your reply. I read the information you provided. Could you also make some examples in this case? Commented Jan 8, 2021 at 11:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.