我的代碼在這里: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 關注
- 211 瀏覽
添加回答
舉報
0/150
提交
取消