PHP 数组转JSON数据(convert array to JSON object);

<?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))."}"; ?>

  

上一篇:基于英特尔® 至强™ 处理器 E5 产品家族的多节点分布式内存系统上的 Caffe* 培训


下一篇:学艺不精,又被shell的管道给坑了