adrsublimacao Postado Janeiro 13, 2023 Denunciar Share Postado Janeiro 13, 2023 essa é minha string como faço pra percorrer os 2 id [{"id":"3b3686e4-59f1-4e31-857f-f56e356cea25","code":"PLC","fullCode":"PLACED","orderId":"5e964b70-db99-4175-94b9-ba6813579167","merchantId":"6fb755ee-b9b0-499c-8c8a-ff6acbd18c73","createdAt":"2023-01-13T19:26:07.886Z"},{"id":"621ad460-f5a5-4e36-b446-834c1dcbf5d3","code":"PLC","fullCode":"PLACED","orderId":"5025400f-11df-4318-8fdf-24ac02d0ee99","merchantId":"6fb755ee-b9b0-499c-8c8a-ff6acbd18c73","createdAt":"2023-01-13T19:26:08.638Z"}]'; estou tentando <?php $jresponse=json_decode('[{"id":"3b3686e4-59f1-4e31-857f-f56e356cea25","code":"PLC","fullCode":"PLACED","orderId":"5e964b70-db99-4175-94b9-ba6813579167","merchantId":"6fb755ee-b9b0-499c-8c8a-ff6acbd18c73","createdAt":"2023-01-13T19:26:07.886Z"},{"id":"621ad460-f5a5-4e36-b446-834c1dcbf5d3","code":"PLC","fullCode":"PLACED","orderId":"5025400f-11df-4318-8fdf-24ac02d0ee99","merchantId":"6fb755ee-b9b0-499c-8c8a-ff6acbd18c73","createdAt":"2023-01-13T19:26:08.638Z"}]'); foreach($jresponse->id as $key => $id){ echo $id['id']."<br>"; } ?> tem alguam sugentao ai Citar Link para o comentário Compartilhar em outros sites More sharing options...
1 Frank K Hosaka Postado Janeiro 13, 2023 Denunciar Share Postado Janeiro 13, 2023 <?php $teste='[{"id":"3b3686e4-59f1-4e31-857f-f56e356cea25", "code":"PLC","fullCode":"PLACED","orderId":"5e964b70-db99-4175-94b9-ba6813579167", "merchantId":"6fb755ee-b9b0-499c-8c8a-ff6acbd18c73","createdAt":"2023-01-13T19:26:07.886Z"}, {"id":"621ad460-f5a5-4e36-b446-834c1dcbf5d3","code":"PLC","fullCode":"PLACED", "orderId":"5025400f-11df-4318-8fdf-24ac02d0ee99", "merchantId":"6fb755ee-b9b0-499c-8c8a-ff6acbd18c73","createdAt":"2023-01-13T19:26:08.638Z"}]'; $jteste=json_decode($teste); var_dump($jteste); echo "<table>"; foreach($jteste as $jt): foreach($jt as $key=>$j): echo "<tr><td>$key<td>=>$j"; endforeach; echo "<tr style=height:25px>"; endforeach; echo "</table>"; Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 adrsublimacao Postado Janeiro 14, 2023 Autor Denunciar Share Postado Janeiro 14, 2023 (editado) 6 horas atrás, Frank K Hosaka disse: <?php $teste='[{"id":"3b3686e4-59f1-4e31-857f-f56e356cea25", "code":"PLC","fullCode":"PLACED","orderId":"5e964b70-db99-4175-94b9-ba6813579167", "merchantId":"6fb755ee-b9b0-499c-8c8a-ff6acbd18c73","createdAt":"2023-01-13T19:26:07.886Z"}, {"id":"621ad460-f5a5-4e36-b446-834c1dcbf5d3","code":"PLC","fullCode":"PLACED", "orderId":"5025400f-11df-4318-8fdf-24ac02d0ee99", "merchantId":"6fb755ee-b9b0-499c-8c8a-ff6acbd18c73","createdAt":"2023-01-13T19:26:08.638Z"}]'; $jteste=json_decode($teste); var_dump($jteste); echo "<table>"; foreach($jteste as $jt): foreach($jt as $key=>$j): echo "<tr><td>$key<td>=>$j"; endforeach; echo "<tr style=height:25px>"; endforeach; echo "</table>"; valeu muito obrigado Editado Janeiro 14, 2023 por adrsublimacao Citar Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
adrsublimacao
essa é minha string como faço pra percorrer os 2 id
[{"id":"3b3686e4-59f1-4e31-857f-f56e356cea25","code":"PLC","fullCode":"PLACED","orderId":"5e964b70-db99-4175-94b9-ba6813579167","merchantId":"6fb755ee-b9b0-499c-8c8a-ff6acbd18c73","createdAt":"2023-01-13T19:26:07.886Z"},{"id":"621ad460-f5a5-4e36-b446-834c1dcbf5d3","code":"PLC","fullCode":"PLACED","orderId":"5025400f-11df-4318-8fdf-24ac02d0ee99","merchantId":"6fb755ee-b9b0-499c-8c8a-ff6acbd18c73","createdAt":"2023-01-13T19:26:08.638Z"}]';
estou tentando
<?php
$jresponse=json_decode('[{"id":"3b3686e4-59f1-4e31-857f-f56e356cea25","code":"PLC","fullCode":"PLACED","orderId":"5e964b70-db99-4175-94b9-ba6813579167","merchantId":"6fb755ee-b9b0-499c-8c8a-ff6acbd18c73","createdAt":"2023-01-13T19:26:07.886Z"},{"id":"621ad460-f5a5-4e36-b446-834c1dcbf5d3","code":"PLC","fullCode":"PLACED","orderId":"5025400f-11df-4318-8fdf-24ac02d0ee99","merchantId":"6fb755ee-b9b0-499c-8c8a-ff6acbd18c73","createdAt":"2023-01-13T19:26:08.638Z"}]');
foreach($jresponse->id as $key => $id){
echo $id['id']."<br>";
}
?>
tem alguam sugentao ai
Link para o comentário
Compartilhar em outros sites
2 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.