“PHP Return json” Respostas de código

PHP Parse JSON

$personJSON = '{"name":"Johny Carson","title":"CTO"}';

$person = json_decode($personJSON);

echo $person->name; // Johny Carson
Grepper

PHP Return json

header('Content-type: application/json');
echo json_encode($array);
Mobile Star

solicitação php json obtenha valor

<?php
$jsonurl = "https://reqres.in/api/users/2";
$json = file_get_contents($jsonurl);
$jsonDecode = json_decode($json, true);
echo $jsonDecode['data']['email'];
?>
Apollo

Dados JSON de retorno PHP

header('Content-Type: application/json'); 

$colors = array("red","blue","green");
echo json_encode($colors);
Grepper

Como receber dados JSON no PHP

$data = json_decode(file_get_contents('php://input'), true);
print_r($data);
echo $data;
Perfect Pigeon

PHP Retorne uma resposta JSON

//PHP File
<?php
$data = /** whatever your data are **/;
header('Content-Type: application/json; charset=utf-8');
echo json_encode($data);

//In JS File
//JQUERY AJAX
        $.ajax({
        url: "path/to_php_file.php",
        dataType: "json",  
        type: "GET",
        data: {datax : datax },
Trevorpergliamici

Respostas semelhantes a “PHP Return json”

Perguntas semelhantes a “PHP Return json”

Mais respostas relacionadas para “PHP Return json” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código