How do I make a .txt file into json?
$linhas = fopen ("sections.txt", "r");
//percorre
while (!feof ($linhas)){
$ponteiro = fgets($linhas, 1096);
$valores = preg_split("[/]",$ponteiro);
$paraTxt = $valores[0];
//não pega o ; inicial do arquivo
$paraTxt = substr ($valores[0],1);// aqui
// echo '<br>'. $paraTxt;
//novo array php
$arrSection[] = array($paraTxt);
$paraJson = json_encode($arrSection);
}
// $paraJson = json_encode($arrSection);
var_dump($paraJson);
//fclose ($linhas); */
do jeito que fiz retornando false.
reader.php: 238: boolean false
Any hint of transforming this file, where it already read and scrolls in the txt format, and when I use the function to transform it into json it returns false That in the end I want to call this array in javascript, be listed in typehead.