YII2.0之Activeform表單組件用法執行個體,yii2.0activeform_PHP教程

來源:互聯網
上載者:User

YII2.0之Activeform表單組件用法執行個體,yii2.0activeform


本文執行個體講述了YII2.0之Activeform表單組件用法。分享給大家供大家參考,具體如下:

Activeform

文字框:textInput();
密碼框:passwordInput();
單選框:radio(),radioList();
複選框:checkbox(),checkboxList();
下拉框:dropDownList();
隱藏欄位:hiddenInput();
文本域:textarea(['rows'=>3]);
檔案上傳:fileInput();
提交按鈕:submitButton();
重設按鈕:resetButtun();

<?php$form = ActiveForm::begin([  'action' => ['test/getpost'],  'method'=>'post',  ]); ?><? echo $form->field($model, 'username')->textInput(['maxlength' => 20]) ?><? echo $form->field($model, 'password')->passwordInput(['maxlength' => 20]) ?><? echo $form->field($model, 'sex')->radioList(['1'=>'男','0'=>'女']) ?><? echo $form->field($model, 'edu')->dropDownList(['1'=>'大學','2'=>'高中','3'=>'初中'],['prompt'=>'請選擇','style'=>'width:120px']) ?><? echo $form->field($model, 'file')->fileInput() ?><? echo $form->field($model, 'hobby')->checkboxList(['0'=>'籃球','1'=>'足球','2'=>'羽毛球','3'=>'乒乓球']) ?><? echo $form->field($model, 'info')->textarea(['rows'=>3]) ?><? echo $form->field($model, 'userid')->hiddenInput(['value'=>3]) ?><? echo Html::submitButton('提交', ['class'=>'btn btn-primary','name' =>'submit-button']) ?><? echo Html::resetButton('重設', ['class'=>'btn btn-primary','name' =>'submit-button']) ?><?php ActiveForm::end(); ?>

希望本文所述對大家基於Yii架構的PHP程式設計有所協助。

您可能感興趣的文章:

  • Yii2使用Bootbox外掛程式實現自訂彈窗
  • 從零開始學YII2架構(四)擴充外掛程式yii2-kartikgii
  • 從零開始學YII2架構(三)擴充外掛程式yii2-gird
  • 從零開始學YII2架構(二)通過 Composer 安裝擴充外掛程式
  • yii2架構中使用下拉式功能表的自動搜尋yii-widget-select2執行個體分析
  • yii2中使用Active Record模式的方法
  • yii2中添加驗證碼的實現方法
  • Yii2架構引用bootstrap中日期外掛程式yii2-date-picker的方法

http://www.bkjia.com/PHPjc/1089937.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1089937.htmlTechArticleYII2.0之Activeform表單組件用法執行個體,yii2.0activeform 本文執行個體講述了YII2.0之Activeform表單組件用法。分享給大家供大家參考,具體如下: Activef...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.