PHP provides useful functions can read file directly instead of open → read → close: readfile(), file_get_contents() - personally I prefer to use file_get_contents(), because it does not display anything after reading the content. |
$src = "src/new.json"; $tmp = readfile( $fileOriginal); echo $tmp; |
Unlike readfile(), it does not display anything on the screen.
$src = "src/new.json"; $tmp = file_get_contents( $fileOriginal); echo $tmp; |