Application.It で db コンテンツを csv ファイルとしてエクスポートする必要があります。ただし、コンテンツは最初の行からではありません。40行目から始まります。これ以上何をしなければなりませんか?
header('Content-Encoding: UTF-8');
header("Cache-Control: cache, must-revalidate");
header("Pragma: public");
header('Content-Type: text/csv, charset=UTF-8; encoding=UTF-8');
$filename = date('Y_m_d_s');
header("Content-Disposition: attachment; filename=\"".$filename.".csv\"");
if($dbResult) {
$cnthead=0; $cntr =count($dbResult[0])-1;
foreach($dbResult[0] as $key => $Val){
echo $key;
if($cnthead < $cntr) {
echo ",";
$cnthead++;
}
}
echo "\n";
foreach($dbResult as $dbRes){
$cntcontnt=0;
foreach($dbRes as $dbVal){
echo $dbVal;
if($cntcontnt < $cntr) {
echo ",";
$cntcontnt++;
}
}
echo "\n";
}
}
$dbResult 配列は以下のようになります。
Array
(
[0] => Array
(
[Appraisee Name] => aaa R
[Team] => Software
[Appraisee Emp No] => -
[Appraiser Name] => vvv A
[Appraiser Emp No] => -
[Reviewer Name] => sss S
[Reviewer Emp No] => -
[Current Appraisal Status] => start
)
[1] => Array
(
[Appraisee Name] => gan R
[Team] => Software
[Appraisee Emp No] => -
[Appraiser Name] => fcv R
[Appraiser Emp No] => -
[Reviewer Name] => sss S
[Reviewer Emp No] => -
[Current Appraisal Status] => start
)
)