检测下载是否完成的最佳方法是什么,因为之后我想更新数据库.
header("Content-Type: application/octet-stream"); header("Content-Length: ".filesize($file)); header("Content-Disposition: attachment; filename=$filename"); // buffered read not using readfile($file); if ($fp = fopen($bestand,'rb')) { while (!feof($fp)) { $buf = fread($fp,4096); echo $buf; $bytesSent += strlen($buf); /* We know how many bytes were sent to the user */ } } if ($bytesSent == filesize($fp)) { //do something with db }