我正在使用 excel/reader.php 读取 CSV 文件并获取数据。
CSV 中的日期字段具有值:20/10/2014
Customer Name Date
Lorem Spem 20/10/14
当我在使用 PHP 阅读 CSV 后打印它时:
$file_name = $_FILES['file']['tmp_name'];
$library_path = getcwd().'/application/libraries/excel/reader.php';
require_once $library_path;
$excel = new Spreadsheet_Excel_Reader();
$excel->setOutputEncoding('CP1251');
$status = $excel->read($file_name);
$totalSheets = count($excel->sheets);
for($sheetCount = 0 ; $sheetCount < $totalSheets ; $sheetCount++)
{
$excel_data = $excel->sheets[$sheetCount]['cells'];
$totalRows = $excel->sheets[$sheetCount]['numRows'];
print_r($excel_data);
}
它给出了结果:21/10/2014
Array ( [1] => Lorem Spem [2] => 21/10/2014 )
我不知道为什么它会在 CSV 的日期上加一天。