私はこのコードをここに用意していますが、ユーザーがダウンロードできる速度を制限したいのですが、このコードにどのように実装すればいいですか?PHPを使用したダウンロード速度の制限
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize("uploads/$filename"));
header("Content-disposition: attachment; filename=\"$origname");
readfile("uploads/$filename");
ありがとうございます!
これは私が試みたものです。
$download_rate = 100;
$ origname = get_file_name($ file [0]);
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize("uploads/$filename"));
header("Content-disposition: attachment; filename=\'$origname'");
$local_file = "uploads/$origname";
//フラッシュコンテンツ フラッシュ();
// open file stream
$file = fopen($local_file, "r");
while (!feof($file)) {
// send the current file part to the browser
print fread($file, round($download_rate * 1024));
// flush the content to the browser
flush();
// sleep one second
sleep(1);
}
// close file stream
fclose($file);
なぜこれは機能しませんか?
ええ、私はこの1つを読んだことがありますが、私は実際にそれを統合する方法が必要です、私は試して失敗したように! – HarryBeasant
まあ、何を試しましたか?どのように失敗したのですか?これは良い出発点のようですので、皆さんがすでに行ったことをやり直すように求めないでください。 – Hamish
エラーが出るか、速くダウンロードするか、失敗したか? – Mike