Storage:: 检查创建文件。拉拉维尔

我的代码在这里:

Storage::disk(‘local’)->put($name,$information);

我想检查我的文件是否已创建并回显消息。如果它会被创建,我想回应“你创建”。如果不是,我想回显“您的文件没有创建”。如何做到这一点?


哈士奇WWW
浏览 233回答 1
1回答

拉风的咖菲猫

您可以使用Storage::exists:$exists = Storage::disk('s3')->exists('file.jpg'); // true/false或file_exists:$filename = '/path/to/foo.txt';if (file_exists($filename)) {    echo "The file $filename exists";} else {    echo "The file $filename does not exist";}
打开App,查看更多内容
随时随地看视频慕课网APP