PHPExcel 检查文件是否保存

PHPExcel check the file is saved

我正在使用 PHPExcel。我正在尝试将文件保存在一个目录中(文件已保存)。我可以确认文件已保存吗?我们使用$writer->save($filename);来保存文件。
我试过

if( $writer->save($filename) ){
    echo "File successfully saved";
}

也喜欢

 if( $writer->save($filename) === true){
    echo "File successfully saved";
 }

有人可以帮忙吗? 提前致谢!

PHPExcel 如果失败则抛出异常;所以 try/catch 块

try {
    $writer->save($filename);
    echo "File successfully saved";
} catch (Exception $e) {
    echo 'ERROR: ', $e->getMessage();
    die();
}