加入收藏 | 设为首页 | 会员中心 | 我要投稿 北几岛 (https://www.beijidao.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

php – Yii Framework:表单构建器

发布时间:2021-08-28 03:43:10 所属栏目:大数据 来源: https://www.jb51.cc
导读:如何使用Yii中的表单构建器创建表单?它的数据模型是什么? 解决方法: How to make a form builder in yii framework? Using Form Builder The Yii form builder uses a CForm object to represent the specifications needed to describe an HTML form, inc

如何使用Yii中的表单构建器创建表单?它的数据模型是什么?

解决方法:

How to make a form builder in yii framework?

Using Form Builder

The Yii form builder uses a CForm object to represent the specifications needed to describe an HTML form, including which data models are associated with the form, what kind of input fields there are in the form, and how to render the whole form. Developers mainly need to create and configure this CForm object, and then call its rendering method to display the form.

What will be its data model?

这是Yii Form Builder页面的一个例子.

public function actionLogin()
{
    $model = new LoginForm;
    $form = new CForm('application.views.site.loginForm', $model);
    if($form->submitted('login') && $form->validate())
        $this->redirect(array('site/index'));
    else
        $this->render('login', array('form'=>$form));
}

该模型在函数的第一行中定义.

以下是Yii文档中的更多模型信息:Creating Model

(编辑:北几岛)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读