PHP 返回 Json 函数:json_encode()

 1 <?php
 2 header('Content-type: text/json');
 3 
 4 $fruits = array (
 5     "fruits"  => array("a" => "orange", "b" => "banana", "c" => "apple"),
 6     "numbers" => array(1, 2, 3, 4, 5, 6),
 7     "holes"   => array("first", 5 => "second", "third")
 8 );
 9 echo json_encode($fruits);
10 ?>

 

posted on 2016-04-08 10:08  Livon  阅读(306)  评论(0编辑  收藏  举报

导航