header('Content-type: application/json');
echo json_encode($array);
header('Content-Type: application/json');
$colors = array("red","blue","green");
echo json_encode($colors);
//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 },
$data = json_decode(file_get_contents('php://input'), true);
print_r($data);
echo $data;
$data = json_decode($json);
//code igniter
$query="qry";
$query = $this->db->query($query);
$res=$query->result();
return json_encode($res);
$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);
$str_json = file_get_contents('php://input');
<?php
$data = /** whatever you're serializing **/;
header('Content-Type: application/json; charset=utf-8');
echo json_encode($data);
Code Example |
---|
Php :: php artisan serve stop |
Php :: class name laravel |
Php :: referencing constant in config laravel |
:: |
Php :: php get array key like |
Php :: laravel request file empty |
Php :: compare two datetime php |
Php :: how to filter laravel eloquent |
Php :: -sale_price |
Php :: hex2bin (PHP 5 = 5.4.0, PHP 7, PHP 8) hex2bin — Decodes a hexadecimally encoded binary string |
Php :: Write a php program to perform sum of two numbers |
Php :: loginByUserID in conrete |
Php :: convert to string php |
Php :: |
Php :: php convert float |
Php :: php url variable xss sanitize |
Php :: php reload after env |
Php :: jwt return true |
Php :: php file iterator |
Php :: laravel validation if another record is not deleted / not null |
Php :: |
Php :: octobercms mail register |
Php :: php user ip from post request |
Php :: status code 301 |
Php :: phpmailer doesnt work |
Php :: php inverse / arc cosine |
Php :: php substr_replace |
Php :: laravel disable logging |
Php :: how to enable auto refresh on save |
Php :: php sum array values by key |