简体   繁体   English

如何解析刀片 laravel 中的值?

[英]How to parse the value in blade laravel?

Parse the laravel array data Am tried not show any data?解析 laravel 数组数据 我试过不显示任何数据? Please suggest to any other source?请建议任何其他来源?

here is the my dd Values in my laravel controller这是我的 laravel controller 中的我的 dd 值

array:2 [▼
  "count" => 5
  "date" => array:1 [▼
    0 => array:5 [▼
      0 => "2019-11-04 15:41:53"
      1 => "2019-11-05 14:28:10"
      2 => "2019-11-12 13:47:31"
      3 => "2019-11-14 12:39:12"
      4 => "2019-11-17 10:54:39"
    ]
  ]
]

am unable to parse the value on blade my tried我无法解析我尝试过的刀片上的值

{{ $nov['date']['0']['0'] }} ---- > here i get the exact value "2019-11-04 15:41:53" i need parse in dynamic data {{ $nov['date']['0']['0'] }} ----> 在这里我得到了我需要在动态数据中解析的确切值“2019-11-04 15:41:53”

@foreach ($nov as $key => $value)
    @foreach ($value as $key => $da)
    {{ $da }}
@endforeach @endforeach

Thanks谢谢

All the dates are in the key of $nov['date'][0] .所有日期都在$nov['date'][0]的键中。 So you've to make a loop by using this key instead of $now .所以你必须使用这个键而不是$now来创建一个循环。

Change in foreach loop and use $nov['date'][0] instead of direct $nav更改 foreach 循环并使用$nov['date'][0]而不是直接$nav

@foreach ($nov['date'][0] as $key => $value)
    @foreach ($value as $key => $da)
    {{ $da }}
@endforeach 

if you print_r($now['date']) you'll get如果你print_r($now['date'])你会得到

    0 => array:5 [▼
      0 => "2019-11-04 15:41:53"
      1 => "2019-11-05 14:28:10"
      2 => "2019-11-12 13:47:31"
      3 => "2019-11-14 12:39:12"
      4 => "2019-11-17 10:54:39"
    ]

and then if you access 0 index like $now['date'][0] then you will get the following data which you need to make a loop.然后如果你访问像$now['date'][0]这样的0索引,那么你将获得以下数据,你需要这些数据来进行循环。

array:5 [▼
          0 => "2019-11-04 15:41:53"
          1 => "2019-11-05 14:28:10"
          2 => "2019-11-12 13:47:31"
          3 => "2019-11-14 12:39:12"
          4 => "2019-11-17 10:54:39"
        ]

Hope you understand.希望你能理解。

If you want to loop just the index 0 of date如果您只想循环日期的索引 0

@foreach ($nov['date']['0'] as $key => $value)
 {{ $value}}
@endforeach 

If you want to loop all the date如果要循环所有日期

@foreach ($nov['date']['0'] as $key => $value)
   @foreach ($value as $key => $da)
    {{ $da }}
  @endforeach 
@endforeach

Use this one.使用这个。

@foreach ($nov['date'] as $key => $value)
    @foreach ($value as $key => $da)
    {{ $da }}
@endforeach @endforeach

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM