您的当前位置:首页>全部文章>文章详情

php实现JSON编码和解码

发表于:2024-03-02 20:32:25浏览:74次TAG: #PHP

JSON编码和解码:

<?php  
$data = array("name" => "John", "age" => 30);  
$jsonData = json_encode($data);  
echo $jsonData . "<br>";  

$decodedData = json_decode($jsonData, true);  
echo $decodedData['name'];  
?>