Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1073609
  • 博文数量: 252
  • 博客积分: 4561
  • 博客等级: 上校
  • 技术积分: 2833
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-15 08:23
文章分类

全部博文(252)

文章存档

2015年(2)

2014年(1)

2013年(1)

2012年(16)

2011年(42)

2010年(67)

2009年(87)

2008年(36)

分类: 系统运维

2012-01-09 09:17:15



test









=============================
login.php

class User {
        public $username;
        public $password;
};

class Result {
        public $totalProperty;
        public $rows;
};

function user_create($username, $password)
{
        $user = new User();

        $user->username = $username;
        $user->password = $password;

        return $user;
}

$result = new Result();
$result->rows = array();


$result->rows[] = user_create('aaaaaaa', 'pppppppp');
$result->rows[] = user_create('bbbbbbb', 'dddddddd');
$result->rows[] = user_create('ccccccc', 'zzzzzzzz');
$result->rows[] = user_create('ddddddd', 'kkkkkkkk');
$result->rows[] = user_create('eeeeeee', 'aaaaaaaa');
$result->rows[] = user_create('fffffff', 'cccccccc');
$result->rows[] = user_create('ggggggg', 'pppppppp');

$result->totalProperty = count($result->rows);

echo json_encode($result);

?>



阅读(873) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~