将PHP数组转换为Json String

时间:2014-05-22 11:36:38

标签: php json

只是想知道是否可以将PHP数组转换为JSON字符串 下面是PHP数组:

array ( 
     'players' => array ( 
          '123' => '345'
          '567' => '789'
      ), 
     'non_players' => array ( 
          0 => '71558060', 
          1 => '14451395', 
          2 => '16428783', 
          3 => '12070702', 
          4 => '16872249', 
          5 => '10081837', 
          6 => '10000363', 
          7 => '10084478', 
     ), 
)

是否可以转换为JSON字符串?

1 个答案:

答案 0 :(得分:0)

您可以使用PHP手册中的json_encode()http://www.php.net/manual/en/function.json-encode.php