Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get json kay value php

$arr = json_decode($json, true);
 
// Loop through the associative array
foreach($arr as $key=>$value){
    echo $key . " => " . $value . "<br>";
}
Comment

php return json

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

php json request get value

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

php return json data

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

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

php return a json response

//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 },
Comment

how to receive json data in php

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

return json in php

//code igniter
$query="qry";
$query = $this->db->query($query);
$res=$query->result();
return json_encode($res);
Comment

how to extract data from json in php

$json = '
{
    "type": "donut",
    "name": "Cake",
    "toppings": [
        { "id": "5002", "type": "Glazed" },
        { "id": "5006", "type": "Chocolate with Sprinkles" },
        { "id": "5004", "type": "Maple" }
    ]
}';

$yummy = json_decode($json);

print_r($yummy);
Comment

Returning JSON from a PHP Script

<?php
$data = /** whatever you're serializing **/;
header('Content-Type: application/json; charset=utf-8');
echo json_encode($data);
Comment

PREVIOUS NEXT
Code Example
Php :: wpml display language switcher 
Php :: encryp with codeigniter 3 
Php :: get php to send email from form 
Php :: laravel gigapay create payout 
Php :: how to insert if php in html 
Php :: laravel collection implode 
Php :: php get domain from url 
Php :: codeigniter set timezone 
Php :: symfony convert entity to array 
Php :: php limit words 
Php :: php form get 
Php :: carbon 2 days ago 
Php :: create date from string php 
Php :: get current user email wordpress 
Php :: codeigniter count rows 
Php :: php is daylight savings 
Php :: convert matrix row to column php 
Php :: smarty if 
Php :: how to remove public from url in laravel 8 
Php :: webstorm vs phpstorm 
Php :: causes of 419 error lravel 
Php :: strlen php 
Php :: add column in laravel migration 
Php :: Check if session exists or not in laravel 
Php :: array push foreach php 
Php :: sentence get first second word php laravel 
Php :: datediff in hour query builder laravel 
Php :: concat() function using laravel eloquent query 
Php :: php array_map passing parameters 
Php :: join cakphp 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =