Remove headers.
Use you server's file path in fopen handle.
$f = fopen('path of file on server ', 'w');
문제
I'm creating a CSV from an array. The problem is that I dont want to download it but I want to save it to a folder in my server. This is my function
protected function array_to_csv_download($array, $filename = "export.csv", $delimiter=";") {
header('Content-Type: application/csv; charset=utf-8');
header('Content-Disposition: attachement; filename="'.$filename.'";');
$f = fopen('php://output', 'w');
foreach ($array as $line) {
fputcsv($f, $line, $delimiter);
}
}
How can I make it so that it saves it to the server? Thanks!
해결책
Remove headers.
Use you server's file path in fopen handle.
$f = fopen('path of file on server ', 'w');