我的代碼在這里:Storage::disk(‘local’)->put($name,$information);我想檢查我的文件是否已創(chuàng)建并回顯消息。如果它會被創(chuàng)建,我想回應(yīng)“你創(chuàng)建”。如果不是,我想回顯“您的文件沒有創(chuàng)建”。如何做到這一點(diǎn)?
1 回答

拉風(fēng)的咖菲貓
TA貢獻(xiàn)1995條經(jīng)驗(yàn) 獲得超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 關(guān)注
- 202 瀏覽
添加回答
舉報
0/150
提交
取消