【问题标题】:is there a way to reestructure file_get_contents output? php [duplicate]有没有办法重新构造 file_get_contents 输出? php [重复]
【发布时间】:2019-07-30 16:23:57
【问题描述】:

我正在尝试从 json 文件中获取一些信息, 该页面中的代码是这样的

{"asignaciones":[{"fecha":"LUNES 29/07","horaEntrada":"18:30","horaSalida":"22:30","tienda":" BK 别墅 Urquiza"}],"fechaConsulta":"29/07/2019 17:27","legajo":"28907"}

我想拍“29/7”、“18:30”、“22:30”。 现在,我可以打印页面中的所有代码,但我只想获取这些数字,有办法使用:file_get_contents?

如果这个问题非常简单,我正在尝试学习更多 php 对不起。

我现在的代码:

$content = file_get_contents('http://proveedores.alsea.com.ar:48080/asignaciones-server/mobile/main/asignaciones/legajos/28907');

echo $content



?>

【问题讨论】:

    标签: php preg-match file-get-contents


    【解决方案1】:

    看起来内容是一个json...从这里开始:

    $content = file_get_contents('http://proveedores.alsea.com.ar:48080/asignaciones-server/mobile/main/asignaciones/legajos/28907');
    $content = json_decode($content);
    print_r($content);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-22
      • 2020-07-04
      • 2014-01-01
      • 2016-08-01
      • 2018-05-16
      • 2016-04-27
      • 1970-01-01
      相关资源
      最近更新 更多