“PHP Return JSON” Código de respuesta

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

php json solicitud obtenga valor

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

PHP Devuelve datos JSON

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

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

Cómo recibir datos JSON en PHP

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

PHP Devuelve una respuesta 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

Respuestas similares a “PHP Return JSON”

Preguntas similares a “PHP Return JSON”

Más respuestas relacionadas con “PHP Return JSON” en PHP

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código