I have an object
$vcpe =
{#298 ▼
+"cpe_mac": "436291229311"
+"bandwidth_max_up": 0
+"bandwidth_max_down": 0
+"filter_icmp_inbound": false
+"dmz_enabled": false
+"dmz_host": "192.168.1.1"
+"vlan_id": 2
+"dns": array:1 [▼
0 => ""
]
+"xdns_mode": 0
+"cfprofileid": 11111
+"stub_response": "0"
+"acl_mode": 0
+"portal_url": ""
+"fullbandwidth_max_up": 1000000
+"fullbandwidth_max_down": 2000000
+"fullbandwidth_guaranty_up": 300000
+"fullbandwidth_guaranty_down": 400000
+"account_id": 1001
+"location_id": 3333
+"network_count": 3
+"group_name": "test_group"
+"vse_id": 20
+"firewall_enabled": false
}
I want to loop through it, and print out the key, and the value.
Try#1
@foreach ($vcpe as $key => $value)
<p>{{$key}} : {{$value}}</p>
@endforeach
I got
htmlentities() expects parameter 1 to be string, array given
Try#2
@foreach ($vcpe as $key => $value)
<p>{!!$key!!} : {!!$value!!}</p>
@endforeach
I got
Array to string conversion
Try#3
@foreach ($vcpe as $key => $value)
@foreach ($key as $k => $v)
<p>{{$k}} : {{$v}}</p>
@endforeach
@endforeach
I got
Invalid argument supplied for foreach()
Can someone please show how do I print out all my key/value of an object ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire