ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
> 以hello world为例 1、新建app/hello文件夹 2. 在hello里新建php文件为: ~~~ main.php <?php if (!defined('IN_ANWSION')) { die; } class main extends AWS_CONTROLLER { public function get_access_rule() { $rule_action['rule_type'] = 'white'; if ($this->user_info['permission']['visit_question'] AND $this->user_info['permission']['visit_site']) { $rule_action['actions'][] = 'index'; } return $rule_action; } public function index_action() { $list = $this->model('hello')->data(); TPL::assign('hello', 'hello world!'); TPL::assign('list', $list); TPL::output('hello/index'); } } ?> ~~~ 3. 在model里新建php文件为: ~~~ hello.php <?php class hello_class extends AWS_MODEL { public function data() { $list = array(array('name'=>'张三','id'=>1),array('name'=>'李四','id'=>2)); return $list; } } ?> ~~~ 4. 在view/default/hello里新建html文件为: ~~~ index.tpl.htm <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <h1><?php echo $this->hello ?></h1> <?php foreach($this->list as $k=>$row){?> <p><em><?php echo $row['id']?></em><?php echo $row['name']?></p> <?php } ?> </body> </html> ~~~ [下载例子](http://www.wecenter.com/manual/example.zip)