0
Good night to all!! Guys, next, I’m getting the following variable from an application in angular:
Array ( [{"nome":"volks","descricao":"conheça_o_novo_modelo_da_volks"}] => )
How can I convert it so that I can access its values? thank you all!! Horatio
Edited: This is the code that receives the data:
<?php
$dados = $_REQUEST;
print_r($dados);
/*
header('Content-Type: application/json charset=utf-8');
$x = array("info_recebida"=> $_REQUEST);
echo json_encode($x);
here momentarily I’m just exhibiting, and that’s where I brought the above variable
so I did it this way, however, getting the data above, and the result was this: <br /> <b>Warning</b>: json_decode() expects Parameter 1 to be string, array Given in <b>C: xampp htdocs blog_da_corretora site wp-content themes slice_tema page-update_carro.php</b> on line <b>4</b><br /> NULL <br /> <b>Warning</b>: json_decode(expects) Parameter 1 to be string, array Given in <b>C: xampp htdocs blog_da_corretora site wp-content themes slice_tema page-update_carro.php</b> on line <b>5</b><br /> NULL
– Horacio Neto
Edit the question and enter the code
php
– NoobSaibot
edited, I put the code you had sent, but then, I took and left only the display... in the view, it brings the Array ( [{"name":"Volks","Description":"known_o_novo_modelo_da_volks"}] => )
– Horacio Neto
I edited the answer, try it the way I left it
– NoobSaibot
so... I copied and pasted like this: <? php $dados = $_POST; // or $dados = $_POST; print_r(json_decode($dados)); the return was : Warning: json_decode() expects Parameter 1 to be string, array Given in C: xampp htdocs blog_da_corretora site wp-content themes slice_tema page-update_carro.php on line 4
– Horacio Neto
See a angular tutorial and php
– NoobSaibot
got it...is the way I would go if I went with put...I thought I could do it the other way in the case of the post!! Thank you so much for the light, Wellington!! Big hug!!! Good night!!
– Horacio Neto