Hi, I want to import log file and add in Controller, then my log content is:
20150424,161711,checkStart,1,Android ID: ea6485a49d63d127
20150424,161711,checkStart,1,Serial ID: 38KCIUJIWZ
20150424,161711,checkStart,1,Kernel Version: #276
if(($handle = fopen( $this->request->data['upload']['tmp_name'], 'r')) !== FALSE) {
while(($data = fgetcsv($handle, 1000, ',')) !== FALSE ) {
$this->request->data['date'] = $data[0];
$this->request->data['time'] = $data[1];
$this->request->data['running'] = trim( $data[2] );
$this->request->data['status'] = trim( $data[3] );
$this->request->data['responses'] = trim( $data[4] );
$testActivityLog = $this->TestActivityLog->patchEntity($testActivityLog, $this->request->data);
if (! $this->TestActivityLog->save($testActivityLog)) {
}
}
}
fclose( $handle );
When $this->request->data through patchEntify(), my data become:
'properties' => [ 'date' => object(Cake\I18n\Time) { 'time' => '1970-08-22T00:00:00+0000', 'timezone' => '+00:00', 'fixedNowTime' => false }, 'time' => object(Cake\I18n\Time) { 'time' => '1970-01-02T20:55:11+0000', 'timezone' => '+00:00', 'fixedNowTime' => false }, 'running' => 'checkStart', 'status' => true, 'responses' => 'Android ID: ea6485a49d63d127' ],
I don't want my date and time is the array, I hope it is:
'properties' => [ 'date' => '20150424',
'time' => '161711',
'running' => 'checkStart', 'status' => true, 'responses' => 'Android ID: ea6485a49d63d127'
],
How can I do?
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment