标签:
<?php
header(‘Content-type: appliction/json; charset=shift-JIS‘);
$data =array();
class Test 
{
public  $userid ;
public $cmt ;
}
for ($x=1; $x<=50; $x++) {
  $test =new Test();
  $test->userid = urlencode("user".strval($x));
  $test->cmt = urlencode("あああああああああああああ".strval($x));
  $data[] =$test; 
}
echo "{".‘"result": true, "entrylist"‘.":".urldecode(json_encode($data))."}";
?>
PHP 数组转JSON数据(convert array to JSON object);
标签:
原文地址:http://www.cnblogs.com/zlog/p/5388106.html