Folder reorganize 1
This commit is contained in:
36
countdown/jpowered/demo/examples/data/csvdataScript.php
Normal file
36
countdown/jpowered/demo/examples/data/csvdataScript.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* read the csv file
|
||||
*/
|
||||
$csvdata = file('csvData.csv');
|
||||
|
||||
$first = TRUE;
|
||||
$dataCount = 1;
|
||||
/*
|
||||
* process each row of the
|
||||
* csv file
|
||||
*/
|
||||
foreach ($csvdata as $datarow)
|
||||
{
|
||||
if ($first) // ignore the first header row
|
||||
{
|
||||
$first = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* extract the temperature value
|
||||
* from each row and write out
|
||||
* the data parameter
|
||||
*/
|
||||
$dataelements = explode(',',$datarow);
|
||||
if (isset($dataelements[1]))
|
||||
{
|
||||
$dataelements[1] = (float)$dataelements[1];
|
||||
print 'data'. $dataCount .'series1: ' . $dataelements[1] . PHP_EOL;
|
||||
$dataCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user