What's new? | Help | Directory | Sign in
Google
i-framework
I-Framework: 基于PHP5面向对象的PHP MVC开发框架
  
  
  
  
    
License: New BSD License
Labels: PHP, PHP5, mvc, framework, oop
Join project
Project owners:
  iwind.liu
Project members:
peterliuzy, chokesleep, chinajsp

I-Framework

I-Framework是基于PHP5面向对象的MVC开发框架

我们的目标是:code meaningfully(更有意义地写代码)

点此查看最新动态

I-F v0.2.1发布

资源

官方网站 http://www.4kiki.net
API http://develop.4kiki.net/framework/iframework/api/
用户手册 http://develop.4kiki.net/framework/iframework/book/
讨论社区 http://if.4kiki.net/bbs/
应用展示 http://code.google.com/p/i-framework/wiki/WhoAreUsingIF
FAQ http://tips.4kiki.net/tag/I-F/

主要特征

示例

model

/**
 * TLog
 *
 * generated by IF-cli at 2008-01-03 19:40:56
 */
class TLog extends IDarDomain {
	public static $MODEL = array(
		"tblName" => "tbl_log",
	);
	
	/**
	 * get domain object manager
	 *
	 * @return IDarManager
	 */
	public static function manager() {
		return parent::manager(__CLASS__);
	}
}

view

<html>
<head>
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
	<title>阅读博客</title>
</head>
<body>
<table>
	<tr>
		<td>标题:</td>
		<td>{$log.title}</td>
	</tr>
	<tr>
		<td valign="top">内容</td>
		<td>{$log.content|simple_text_format}</td>
	</tr>
</table>

</body>
</html>

controller http://localhost/index/read/1 对应 appRead方法

<?php
class IndexController extends IApplication {
	public function init() {
	}
	
	/**
	 * 读取日志
	 *
	 */
	public function appRead() {
		$id = $this->in->id;
		$this->log = TLog::manager()->find($id);
	}
	
	/**
	 * 添加日志
	 *
	 */
	public function appAdd() {
		$log = new TLog();
		$log->save(array(
			"content" => $this->in->content,
			"categoryId" => $this->in->category_id,
			"submitDate" => date("Y-m-d H:i:s")
		));;
		echo "add ok";
	}
	
	/**
	 * 删除日志
	 *
	 */
	public function appDelete() {
		$id = $this->in->id;
		$log = TLog::manager()->find($id);
		$log->delete();
		echo "delete ok";
	}
	
	
	/**
	 * 修改日志
	 *
	 */
	public function appModify() {
		$id = $this->in->id;
		$this->log = TLog::manager()->find($id);
		
		//如果是post方法
		if ($this->in->isPost()) {
			$this->log->save(array(
				"content" => $this->in->content,
				"categoryId" => $this->in->category_id
			));
			echo "modify ok";
		}
	}
	
	public function destroy() {

	}
	
	
}