谁能给我一些关于如何用PHP编写以下代码的想法吗?因为下面的代码是用C#编写的
var response = HttpContext.Current.Response;
response.Clear();
response.AppendCookie(new HttpCookie("fileDownloadToken", downloadTokenValue);
response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}",
desiredFileName));
response.Flush();
提前感谢
你可以通过这种方式实现,
<?php
$downloadTokenValue = 'Youre Value';
$desiredFileNames = 'Desired File Name Value';
setcookie("fileDownloadToken", $downloadTokenValue, time()+3600);
header("content-disposition: attachment;filename=$desiredFileNames");
?>
如果你想阅读Cookie,你可以echo $_COOKIE["fileDownloadToken"]
;