以下是类方法中的代码:
$this->p($result);//die();
$this->spreadSheet($result); //die();
$this->p($result);die();
首次打印电话的结果(this-> p)
Array
(
[0] => Array
(
[BLOCK_ID] => 537-14547
[SawnOn] => Gang saw
[ORIG_VOLUME_BRUT] => 179.67
[ORIG_VOLUME_NET] => 103.38
[COUTS_TOTAUX] => 2413.92
[COUTS_TRANSPORT] => 0
[SLABCOUNT] => 20
[totalSlabVolume] => 117.48
[totalSurfaceArea] => 1127.78
[totalValue] => 9563.56
[RECEPTION_DATE] => 03/22/2013
[1st Quality] => 100
[Second Quality] => 0
[Standard Slab] => 0
)
[1] => Array
(
[BLOCK_ID] => 618-11523
[SawnOn] => Gang saw
[ORIG_VOLUME_BRUT] => 241.46
[ORIG_VOLUME_NET] => 171
[COUTS_TOTAUX] => 11858.85
[COUTS_TRANSPORT] => 0
[SLABCOUNT] => 56
[totalSlabVolume] => 143.44
[totalSurfaceArea] => 2295.03
[totalValue] => 21687.43
[RECEPTION_DATE] => 03/29/2013
[1st Quality] => 91.07
[Second Quality] => 7.14
[Standard Slab] => 1.79
)
[2] => Array
(
[BLOCK_ID] => 237-14593
[SawnOn] => Gang saw
[ORIG_VOLUME_BRUT] => 312.5
[ORIG_VOLUME_NET] => 260.23
[COUTS_TOTAUX] => 12061.66
[COUTS_TRANSPORT] => 0
[SLABCOUNT] => 40
[totalSlabVolume] => 160.27
[totalSurfaceArea] => 1538.55
[totalValue] => 14016.18
[RECEPTION_DATE] => 03/22/2013
[1st Quality] => 0
[Second Quality] => 17.5
[Standard Slab] => 82.5
)
)
第二次打印结果:
Array
(
[0] => Array
(
[BLOCK_ID] => 537-14547
[SawnOn] => Gang saw
[ORIG_VOLUME_BRUT] => 179.67
[ORIG_VOLUME_NET] => 103.38
[COUTS_TOTAUX] => 2413.92
[COUTS_TRANSPORT] => 0
[SLABCOUNT] => 20
[totalSlabVolume] => 117.48
[totalSurfaceArea] => 1127.78
[totalValue] => 9563.56
[RECEPTION_DATE] => 03/22/2013
[1st Quality] => 100
[Second Quality] => 0
[Standard Slab] => 0
)
[1] => Array
(
[BLOCK_ID] => 618-11523
[SawnOn] => Gang saw
[ORIG_VOLUME_BRUT] => 241.46
[ORIG_VOLUME_NET] => 171
[COUTS_TOTAUX] => 11858.85
[COUTS_TRANSPORT] => 0
[SLABCOUNT] => 56
[totalSlabVolume] => 143.44
[totalSurfaceArea] => 2295.03
[totalValue] => 21687.43
[RECEPTION_DATE] => 03/29/2013
[1st Quality] => 91.06999999999999
[Second Quality] => 7.14
[Standard Slab] => 1.79
)
[2] => Array
(
[BLOCK_ID] => 237-14593
[SawnOn] => Gang saw
[ORIG_VOLUME_BRUT] => 312.5
[ORIG_VOLUME_NET] => 260.23
[COUTS_TOTAUX] => 12061.66
[COUTS_TRANSPORT] => 0
[SLABCOUNT] => 40
[totalSlabVolume] => 160.27
[totalSurfaceArea] => 1538.55
[totalValue] => 14016.18
[RECEPTION_DATE] => 03/22/2013
[1st Quality] => 0
[Second Quality] => 17.5
[Standard Slab] => 82.5
)
)
现在在第二个输出的Array [1]中看到第一个质量的值。它已从91.07更改为91.0699999999。 什么可能导致这个?
以下是上述代码中调用的2个方法的代码:
function spreadSheet($blocks)
{
$this->excel->getProperties()->setCreator("Maper")
->setLastModifiedBy("Maper")
->setTitle("Maper")
->setSubject("Maper")
->setDescription("Maper")
->setKeywords("Maper")
->setCategory("Maper");
$i=1;
$col='A';
$columns = $this->tableHeadings;
foreach ($columns as $column) {
$this->excel->getActiveSheet()->setCellValue($col++ . $i, $column);
}
foreach($blocks as $columns)
{
$i++;
$col = 'A';
foreach($columns as $column)
{
if($col=='A')$sheetName=$column;
$this->excel->getActiveSheet()->setCellValue($col++ . $i, $column);
}
$this->_addSheet($sheetName);
$this->excel->getActiveSheet()->getCell('A'.$i)->getHyperlink()->setUrl("sheet://'".$sheetName."'!A1");
}
$this->excel->getActiveSheet()->setTitle('Blocks');
$this->setStyles();
//$this->_forceSpreadsheetDownload();
$this->_saveSpreadsheet();
}
p方法:
function p($arr)
{
echo"<pre>";
print_r($arr);
echo"</pre>";
}