Boa tarde.
Como devo montar o foreach
para pegar os valores:
- barcode;
- link;
- charge.
deste array
:
array (
'code' => 200,
'data' =>
array (
'barcode' => '00000.00000 00000.000000 00000.000000 0 00000000000000',
'link' => 'https://visualizacaosandbox.gerencianet.com.br/emissao/196843_16_MEHZE5/A4XB-AAAAAA-AAAAAA-AAAAAA',
'pdf' =>
array (
'charge' => 'https://download.gerencianet.com.br/196843_16_MEHZE5/196843-AAAAAA-AAAAAA.pdf?sandbox=true',
),
'expire_at' => '2019-09-04',
'charge_id' => 758277,
'status' => 'waiting',
'total' => 10000,
'payment' => 'banking_billet',
),
)
PHP
foreach ($row_rs["dataBoleto"]["data"] as $row) {
echo $row["code"];
}
Obrigado.
var_dump($row_rs);
array(20) { ["ID_Receita"]=> string(2) "20" ["id_cadastro"]=> string(2) "11" ["nome"]=> string(20) "Aluno de teste teste" ["matricula"]=> string(14) "70-47064508-19" ["parcela"]=> string(6) "1 de 4" ["planoDeConta"]=> string(5) "1.1.3" ["valor"]=> string(6) "175.00" ["dataLanc"]=> string(10) "2019-09-03" ["dataVenci"]=> string(10) "2019-10-03" ["dataPago"]=> NULL ["contaBancaria"]=> string(1) "2" ["formaEntrada"]=> string(1) "6" ["obs"]=> NULL ["cheqNomeProprietario"]=> NULL ["cheqBanco"]=> NULL ["cheqAgencia"]=> NULL ["cheqConta"]=> NULL ["cheqNumero"]=> NULL ["cheqDataDeposito"]=> NULL ["dataBoleto"]=> string(409) "{"code":200,"data":{"barcode":"00000.00000 00000.000000 00000.000000 0 00000000000000","link":"https://visualizacaosandbox.gerencianet.com.br/emissao/196843_16_MEHZE5/A4XB-AAAAAA-AAAAAA-AAAAAA","pdf":{"charge":"https://download.gerencianet.com.br/196843_16_MEHZE5/AAAAAA-AAAAAA-AAAAAA.pdf?sandbox=true"},"expire_at":"2019-09-04","charge_id":758277,"status":"waiting","total":10000,"payment":"banking_billet"}}" }
echo $row["barcode"];