我有这段代码,
<?php
require "vendor/autoload.php";
error_reporting(E_ALL);
use \Objects\Csv as Csv;
$csv = new Csv();
$originalCsv = $csv->getCsv('OriginalInventory.csv');
$updpateCsv = $csv->getCsv('UpdatedInventory.csv');
$finalCsv = $csv->mergeCsv($originalCsv, $updpateCsv);
echo "Duplicate Style #s: " . $csv->duplicate;
echo "<br>";
echo "Items missing from Original CSV: " . $csv->missing;
$csv->download();
和这种下载方法
public function download()
{
# Download
header("Content-Type:application/csv");
header("Content-Disposition:merge;filename=FullInventory-merged.csv");
$output = fopen("php://output",'w') or die("Can't open php://output");
fputcsv($output, $this->new[0]);
unset($this->new[0]);
foreach ($this->new as $key => $value) {
fputcsv($output, $value);
}
fclose($output) or die("Can't close php://output");
}
如何使回声发挥作用。在浏览器上打印输出并下载csv?
鉴于我的代码,这只会下载csv但不会在浏览器上显示打印。