在流明控制器功能中:
使用BinaryFileResponse,我可以从存储文件夹中存在的file.txt中获取文本,但是响应包含的文本已完全删除了换行符。
public function gettxt(Request $request){
//...
$path =storage_path().DIRECTORY_SEPARATOR."test.txt";
$response = new BinaryFileResponse($path);
BinaryFileResponse::trustXSendfileTypeHeader();
return $response;
}
在notepad ++中打开原始文本文件显示LF为行尾。
我希望控制器以换行符作为响应。
edit:laravel中的相同内容通过必要的新行为我提供了正确的响应。