0
クッキーをPDFと共にダウンロードする必要があります。私は次の関数にsetcookieを追加しましたが、うまくいきません。どうしましたか?ありがとうphp - pdfと一緒にクッキーをダウンロード
protected function send_download($file) {
if (file_exists($file)) {
set_time_limit(0);
header('Connection: Keep-Alive');
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file).'"');
setcookie("fileDownloadToken", "fileDownloadToken", time()+360); // 10 minutes
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
}
}