I have a txt file with this structure:
17/02/2016 9:50 [info] "hello"
17/02/2016 10:20 [debug] "world"
now I'm trying to read it with:
$fh = fopen($this->_logPath, "r");
$content = array();
while ($line = fgets($fh))
{
array_push($content, $line);
}
fclose($fh);
return json_encode($content);
the file is readed correctly but, in my chrome extension for try Rest API I get in the json tab:
unexpected string
how I can return each line in json content? For example a result like this:
"trace": {
info: {
date: {
"17/02/2016 9:50" {
-"content": "hello"
}
}
}
debug: {
date: {
"17/02/2016 10:20" {
-"content": "world"
}
}
}
}
or if someone have a better organization I'll glad to see.