jjzjj

ResponseHeaderBag

全部标签

php - 使用 Silex 将文件作为下载提供

我的Controller是基本的$app->get('/files/{type}',function($type)use($app){$path=__DIR__."/../files/$type";if(!file_exists($path)){$app->abort(404,"Cefichiern'existepas.");}return$app->sendFile($path);})->bind('getfile');根据这个doc有用。当我调用正确的URL时,文件会在当前窗口中打开。但是我不想在浏览器中打开文件,我想打开对话框只保存文件。我该怎么做?