“json_encode () en php” Réponses codées

php json_encode

$person = array( 
    "name" => "Johny Carson", 
    "title" => "CTO"
); 
$personJSON=json_encode($person);//returns JSON string
Grepper

Fonction javascript dans php json_encode

$function = "#!!function(){}!!#"; 
$message = "Hello";

$json = array(   
  'message' => $message,
  'func' => $function
);
$string = json_encode($json);
$string = str_replace('"#!!','',$string);
$string = str_replace('!!#"','',$string);
echo $string;
Alive Ape

json_encode () en php

<?php
	// the php array
  	$array = array();
	$array['key1'] = "value1";
	$array['key2'] = "value2";
	$array['key3'] = "value3";

	// encode the php array into JSON format
	$json = json_encode($array);

	// check out the results
	var_dump($json);
?>
CoderHomie

tableau jsondecode php

<?php
    $json=file_get_contents("http://west.basketball.nl/db/json/stand.pl?szn_Naam=2014-2015&cmp_ID=373");
    $data =  json_decode($json);

    if (count($data->stand)) {
        // Open the table
        echo "<table>";

        // Cycle through the array
        foreach ($data->stand as $idx => $stand) {

            // Output a row
            echo "<tr>";
            echo "<td>$stand->afko</td>";
            echo "<td>$stand->positie</td>";
            echo "</tr>";
        }

        // Close the table
        echo "</table>";
    }
?>
Fierce Fly

Réponses similaires à “json_encode () en php”

Questions similaires à “json_encode () en php”

Plus de réponses similaires à “json_encode () en php” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code