- 论坛徽章:
- 0
|
老大,你的代码和思想怎么和我写的好好相似呢。下面的仅仅是举个例子,不完整. 我自个儿写的一个MVC框架,可别说我是剽窃你的哦.
<?php
include_once($_SERVER['DOCUMENT_ROOT'].'/include/core.php');
include_once(CLASS_DIR.'/channel.class.php');
class ChannelPage extends Page
{
function __construct()
{
}
function input(){}
function process()
{
global $db;
$channel = new Channel($db);
$this->channel = $channel->getAll(20);
array_walk($this->channel, array($this, 'toUTF8'));
$this->output();
}
function output()
{
$rs = new StdClass();
$rs->root = $this->channel;
$rs->totalCount = count($this->channel);
echo json_encode($rs);
}
function toUTF8(&$v, $k)
{
$v['html_title']=$v['name'] = iconv('gbk','utf-8', $v['name']);
}
}
$page = new ChannelPage();
$page->process();
?>
[ 本帖最后由 angeljyt 于 2008-3-20 14:11 编辑 ] |
|