我的代码在这里:Storage::disk(‘local’)->put($name,$information);我想检查我的文件是否已创建并回显消息。如果它会被创建,我想回应“你创建”。如果不是,我想回显“您的文件没有创建”。如何做到这一点?
1 回答
拉风的咖菲猫
TA贡献1995条经验 获得超2个赞
您可以使用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";
}
- 1 回答
- 0 关注
- 232 浏览
添加回答
举报
0/150
提交
取消
