如何在php中向解码的json数组添加换行符

如何在php中向解码的json数组添加换行符,php,arrays,json,Php,Arrays,Json,我需要在每个段(日期、姓名、地址、电话)之后添加某种换行符来分隔它们,我尝试过使用换行符和段落等,但总是会出现语法错误,通常会出现意想不到的“为了输出,您必须断开PHP块 <?php foo(); ?> All mimsy were the borogoves, and the mome raths outgrabe. <?php bar(); ?> 所有的米姆西人都是博罗戈夫人,而摩米拉斯人则被压倒了。 必须断开PHP块才能输出 <?php foo

我需要在每个段(日期、姓名、地址、电话)之后添加某种换行符来分隔它们,我尝试过使用换行符和段落等,但总是会出现语法错误,通常会出现意想不到的“为了输出,您必须断开PHP块

<?php
  foo();
?>
All mimsy were the borogoves, and the mome raths outgrabe.
<?php
  bar();
?>

所有的米姆西人都是博罗戈夫人,而摩米拉斯人则被压倒了。

必须断开PHP块才能输出

<?php
  foo();
?>
All mimsy were the borogoves, and the mome raths outgrabe.
<?php
  bar();
?>

所有的米姆西人都是博罗戈夫人,而摩米拉斯人则被压倒了。
使用以下代码:

<?php
    $file = file_get_contents('http://somesite.com/Data/jsontxt');
    $out = (json_decode($file));

    echo $out->date    . '<br/>';
    echo $out->name    . '<br/>';
    echo $out->address . '<br/>';
    echo $out->phone   . '<br/>';
?>

使用以下代码:

<?php
    $file = file_get_contents('http://somesite.com/Data/jsontxt');
    $out = (json_decode($file));

    echo $out->date    . '<br/>';
    echo $out->name    . '<br/>';
    echo $out->address . '<br/>';
    echo $out->phone   . '<br/>';
?>