《bosheng技术分析.pptVIP

  • 3
  • 0
  • 约5.85千字
  • 约 22页
  • 2016-12-28 发布于北京
  • 举报
吴清忠 2013/4/15 updated Bosun Community Framework Quick Guide Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. 提要 框架目录结构 Router Controller Model View Request Response Components Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. 框架目录结构 目录结构: MVC下所有文件夹、文件命名首字母大写驼峰命名 Models 按相关业务逻辑分目录 Config.inc.php 分文件放config目录下 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. Router 路由规则 去index.php 单一入口 没有匹配规则,跳转到404.html http://community/blog/zhong/list Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. Controller $this-get()获得$_GET参数,$this-post()获得$_POST参数,亦可指定key获得对应变量,如:$this-post(‘id); $this-form($keys)获得整个表单数据,$keys可以通过$this-_keys来定义 $this-model(‘Users’)可获得UsersModel(内应用调用关联的业务也直接调用这个方法) 只有调用$this-display()才会显示模版内容,不是默认模版带模版文件名与模版路径参数:$this-display(‘View.php’, ‘views/Index’); 魔术变量: $this-model:获得与Controller同名Model $this-com-pager:返回Com_Pager分页组件 $this-request:请求对象,$this-response:响应对象 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. Model CRUD操作,$this-sql($sql)直接返回SQL结果 如果是SELECT语句则返回结果集,INSERT语句则返回Last Insert Id,UPDATE、DELETE则返回影响行数 $this-load($id)按主键返回单条数据, 不是主键加上列参数,如:$this-load($id, ‘id’); $this-find()按条件获得数据集,默认参数:array(fileds = *, where = 1, order = null, start = -1, limit = -1); $this-count($where, $table = null) 直接返回统计结果 $this-cache($name) 返回Cola_Cache对象 $this-cached($func)魔术方法,可对Model中任何一个函数加缓存,类似装饰模式 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. Model Debug 调试SQL $model = new models_User_Base (); $model-db-debug = TRUE; $data = $model-test(); $log = $model-db-log; var_dump($data); var_dump($log); 查错 $this-error() $model = $this-model(Index); if ($data = $model-testError()) { var_du

文档评论(0)

1亿VIP精品文档

相关文档