-1
を返します。のstrtotimeは、私はUnixタイムスタンプのこのセットを持っている偽
マイコード:
$eventhour = '1473804000';
$client = array(
'pt' => $pt,
'eventhour' => date('Y-m-d H:i:s', $eventhour),
'activepower' => $avg['system.avg(activepower)']
);
eventhour
キーが空である、私は推測する機能date
はfalseを返されました。 UNIXのタイムスタンプは有効ですが、なぜfalseに戻っていますか?
マイループコード
foreach ($result as $row):
$pt = $row['pt'];
$statement = new \Cassandra\SimpleStatement("select avg(activepower) FROM datavalue_test_by_hour WHERE pt= :pt AND eventhour = :eventhour;");
$options = new \Cassandra\ExecutionOptions(
array('arguments' => array('pt' => $pt, 'eventhour' => $row['eventhour'])))
;
$data = $this->cassandra->executeWithOptions($statement, $options);
$eventhour = $row['eventhour'];
echo $eventhour . PHP_EOL;
$avg = $data->first();
$client = array(
'pt' => $pt,
'eventhour' => date('Y-m-d H:i:s', $eventhour),
'activepower' => $avg['system.avg(activepower)']
);
print_r($client);
//fputcsv($fp, $client);
endforeach;
マイますprint_r():
1462554000
Array
(
[pt] => AFH0AEFB0BFDEI
[eventhour] =>
[activepower] => 0.02475
)
1474887600
Array
(
[pt] => A0A0AEAF0DI0H0
[eventhour] =>
[activepower] => 0.1115
)
1475244000
Array
(
[pt] => AFH0ADE0AB0GDI
[eventhour] =>
[activepower] => 0.0905
)
1473008400
Array
(
[pt] => A0A0AEAF0GDFHB
[eventhour] =>
[activepower] => 0.014
)
1470693600
Array
(
[pt] => AFH0AEE00AF0FG
[eventhour] =>
[activepower] => 0.051
)
1452200400
Array
(
[pt] => AFH0AEE00BACIC
[eventhour] =>
[activepower] => 0.152
)
1463637600
Array
(
[pt] => AFH0ACFB00CD0F
[eventhour] =>
[activepower] => 0.041
)
$ eventhourは投稿したコードのどこにも定義されていません –
は$ eventhour = 1473804000ですか? –
はいそれがあります!私は質問を編集する! –