How to decode values coming from javascript?

0

Good evening everyone! Personal, following, I'm getting the following variable from an application in angulajs:

   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!! Horacio

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 showing off, and that's where I brought the above variable

    
asked by anonymous 17.08.2017 / 04:17

1 answer

1

Following the PHP manual , you can use the json_decode strong>

$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json));
var_dump(json_decode($json, true));

Solution:

$dados = $_REQUEST;
// ou $dados = $_POST;
print_r(json_decode(dados));
    
17.08.2017 / 04:20