-7
私はフォーラムで次のスクリプトを見つけました。 問題は、ソースファイルがバーチカルバーの区切り文字 "|"を持つPHPファイルであることです。ダウンロードした結果をCSVファイルにして、 "|"ファイルを保存するとExcelで開くことができるように、 "、"で囲みます。 '|' は おかげテキストファイルの区切り文字をPHPで変更する
<?php
$local_file = 'memberslogin.php';
$download_file = 'memberslist.php';
// set the download rate limit (=> 20,5 kb/s)
$download_rate = 20.5;
if(file_exists($local_file) && is_file($local_file))
{
header('Cache-control: private');
header('Content-Type: application/octet-stream');
header('Content-Length: '.filesize($local_file));
header('Content-Disposition: filename='.$download_file);
flush();
$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);
}
fclose($file);}
else {
die('Error: The file '.$local_file.' does not exist!');
}
?>
感謝のscytale、私の最初の考えは、2つのステップに変換し、最初に結果をダウンロードして、私はあなたの提案が良いと好きなのが好きです。私はデータ入力を制御しており、カンマをデータベースに保存する前に取り除いています。クラブ財務担当者は、コンピュータの知識が豊富ではなく、年配の人で、私が "|"分離されたファイル。私はあなたがこの仕事をする良い方法を提供できるかどうかを見て興味を持っています...乾杯 –