~~~
文本框: textInput();
密碼框: passwordInput();
單選框: radio(),radioList();
復選框: checkbox(),checkboxList();
下拉框: dropDownList();
隱藏域: hiddenInput();
文本域: textarea(['rows'=>3]);
文件上傳: fileInput();
提交按鈕: submitButton();
重置按鈕: resetButtun();
~~~
~~~
<?php
$form = ActiveForm::begin(['action' => ['test/getpost'],'method'=>'post',]); ?>
<?= $form->field($model, 'username')->textInput(['maxlength' => 20]) ?>
<?= $form->field($model, 'password')->passwordInput(['maxlength' => 20]) ?>
<?= $form->field($model, 'sex')->radioList(['1'=>'男','0'=>'女']) ?>
<?= $form->field($model, 'edu')->dropDownList(['1'=>'大學','2'=>'高中','3'=>'初中'], ['prompt'=>'請選擇','style'=>'width:120px']) ?>
<?= $form->field($model, 'file')->fileInput() ?>
<?= $form->field($model, 'hobby')->checkboxList(['0'=>'籃球','1'=>'足球','2'=>'羽毛球','3'=>'乒乓球']) ?>
<?= $form->field($model, 'info')->textarea(['rows'=>3]) ?>
<?= $form->field($model, 'userid')->hiddenInput(['value'=>3])->label(false) ?>
<?= Html::submitButton('提交', ['class'=>'btn btn-primary','name' =>'submit-button']) ?>
<?= Html::resetButton('重置', ['class'=>'btn btn-primary','name' =>'submit-button']) ?>
<?php ActiveForm::end(); ?>
~~~
- 前文
- 安裝前的準備
- windows安裝Composer
- Linux安裝Composer
- 開始使用
- 安裝yii2.0
- 初始化項目
- 檢測運行環境
- 數據庫
- 連接數據庫
- 添加
- 查詢
- join
- joinWith
- with
- asArray
- offset
- filterWhere
- 關聯查詢
- 更新
- AR更新
- with和JoinWith的區別?
- Yii2.0框架基礎--數據查詢之AR類方法一
- 數據庫遷移Migration
- 查看最后執行SQL語句
- 事務處理
- 例子
- 控制器
- rules驗證方法
- behaviors行為
- actions動作
- 模型
- 模型使用
- attributeLabels
- tableName
- fields
- 視圖
- 顯示視圖
- 獲取配置參數
- 格式化時間顯示
- Activeform效果
- Activeform表單部分組件使用方法
- RESTful服務
- 版本化控制
- 郵件mail
- 郵件配置
- 郵件樣板
- session
- Yii2.0 Session操作大全(增、刪、改、銷毀、Session數組賦值、讀取)
- 緩存
- 跨APP讀取緩存(文件緩存)
- Memcache
- 最佳實踐
- 控制器
- 模型
- 視圖
- 常見問題
- 解決根目錄沒有vendor目錄
- 安裝composer-asset插件錯誤
- Url隱藏index.php
- nginx配置
- Apache配置
- 配置
- 設置系統默認中文提示
- 數據庫問題
- where和andWhere不能同時使用嗎?
- debug
- 編輯器使用技巧
- phpstorm
- Redis
- redis安裝
- redis例子
- RBAC
- Redis和memcache概念
- 生成接口文檔
- Swagger安裝
- Swagger語法
- 擴展
- 七牛云存儲
- 視頻縮略圖
- Pjax
- A鏈接不能跳轉解決辦法