Home  >  Article  >  php教程  >  phpcms v9二次开发之表单类form.class.php的应用

phpcms v9二次开发之表单类form.class.php的应用

WBOY
WBOYOriginal
2016-06-07 17:23:461206browse

phpcms v9的系统类库有一个表单类,它封装了表单的一些组件,如编辑器、图片上传、时间选择器、模板选择器等,更详细请参考form.class.php。有了这些组件,在对phpcms v9进行二次开发时,更加省时省心。我们要做的就是如何把这些工具调出来使用。调用方法总共有两种。


一、视图调用法
这种方法最简单,但有局限性。在后台的模型定义字段时,选择表单的类型就会生成相应的表单类型。


二、代码调用法
这种方法比较灵活,走出了内容模块的限制,不再拘泥于内容模型的框架。下面是一个足球模块控制器添加信息的方法,看代码:
表单类的位置:libs\classes--form.class.php


public function addfbteam(){ 
           $levels = $this->level->select('','`id`,`level`','','id'); 
          if(isset($
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:jsonNext article:关于thinkphp优化的一点总结