<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                1、Request組件 Request封裝了$_SERVER,統一了不同Web服務器的變量 , 并且提供$_POST,$_GET,$_COOKIES ,還包括HTTP中PUT、DELETE等方法 2、調用Request組件 1) 直接調用Request類 : \Yii::$app->request 2) 常用Request方法及屬性 判斷是不是Ajax請求:\Yii::$app->request->isAjax 判斷是不是Post請求:\Yii::$app->request->isPost 獲取用戶瀏覽器:\Yii::$app->request->userAgent 獲取用戶IP:\Yii::$app->request->userIp 讀取$_GET全部數據 : \Yii::$app->request->get() 讀取$_GET數據 :\Yii::$app->request->get(‘username’) 讀取$_POST全部數據:\Yii::$app->request->post() 讀取$_POST數據:\Yii::$app->request->post('username') 更多的信息可以查閱:http://www.yiiframework.com/doc-2.0/yii-web-request.html 3、Html組件 \yii\helpers\Html組件 , 提供了封裝好的Html代碼 , 直接調用Html的相對方法就可以生成相對應的Html代碼 。 4、調用常用的Html組件之直接生成Html 1) 生成表單 //beginForm(‘提交的Url’ , ‘類型POST或GET’ , ‘單表的屬性id,class等’) <?=\yii\helpers\Html::beginForm('' , 'post' , ['id' => 'addForm']);?> //endForm也是必須,就是閉合表單 <?=\yii\helpers\Html::endForm();?> 2) 生成Text輸入框 //input(“類型text/password/text” , ‘name的名稱’ , ‘默認值’ , ‘屬性例如class,id等’); <?=\yii\helpers\Html::input('text' , ‘name’, '' , ['class'=>'name' , 'id' => 'name']);?> //直接生成指定類型的typeInput(‘name的名稱’ , ‘默認值’ , ‘屬性例如class,id等’) //直接生成password類型的輸入框 <?=\yii\helpers\Html::passwordInput('pwd' , '' , ['id' => 'password'])?> //直接生成text類型的輸入框 <?=\yii\helpers\Html::textInput("name" , '' , ['id' => 'name'])?> //直接生成hidden類型的隱藏框 <?=\yii\helpers\Html::hiddenInput("hidden" , '' , ['id' => 'hidden'])?> 3) 生成textArea //textarea(‘name的名稱’ , ‘默認值’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::textarea('intro' , '' , ['class'=>'intro' ]);?> 4) 生成radio 及radio列表 //radio(‘name的名稱’ , ‘是否選中true/false’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::radio('status' , false , ['class' =>'status'])?> //radioList(‘name的名稱’ ,’選中的值’ , ‘數組選中鍵值’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::radioList('fav' , 1 , [1 => 'test' , 2 => 'mrs' ] , ['class'=>'fav-list'])?> 5) 生成checkbox 及checkbox列表 //checkbox(‘name的名稱’ , ‘是否選中true/false’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::checkbox("ckbox" , false , ['class' => 'ckbox'])?> //checkboxList(‘name的名稱’ ,’選中的值’ , ‘數組選中鍵值’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::checkboxList('cklist' , 1 , [1 => 'mr' , 2 => 's' ] , ['class'=>'cklist'])?> 6)生成select下拉框 //dropDownList(‘name的名稱’ ,’選中的值’ , ‘數組選中鍵值’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::dropDownList('sts' , 0 , [1 => '是' , 0 => '否' ] , ['class'=>'sts'])?> 7)生成label //label(‘顯示的名稱’ , ‘for的字段’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::label('name:' , 'uname' , ['class'=>'label'])?> 8)生成上傳控件 //fileInput(‘name的名稱’ , ‘默認值’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::fileInput('image' , null , ['class'=>'upload' ])?> 9)生成按鈕 //button(‘顯示的文字’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::button("按鈕" , ['class' => 'btn'])?> <?=\yii\helpers\Html::submitButton("提交按鈕" , ['class' => 'btn-submt'])?> <?=\yii\helpers\Html::resetButton("重置" , ['class' => 'btn-reset'])?> 5、調用常用的Html組件之生成與Model字段關聯的Html 1)生成Text輸入框 //$model是實例化一個Model , title則是他的字段 //activeInput(‘input的類型text/password’ , ‘實例化Model’, ‘字段’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::activeInput('title' , $model, 'title' , ['class' => ‘input'])?> //直接生成指定類型的typeInput(‘ ‘實例化Model’ , ‘字段’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::activeTextInput($model, 'name' , ['class' => 'input'])?> <?=\yii\helpers\Html::activePasswordInput($model, 'pwd' , ['class' => 'input'])?> <?=\yii\helpers\Html::activeHiddenInput($model, 'name' , ['class' => 'input'])?> 2)生成textArea //activeTextarea(‘實例化Model’, ‘字段’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::activeTextarea($model , 'content' , ['class'=>'intro' ]);?> 3)生成radio 及radio列表 //activeRadio(‘實例化Model’, ‘字段’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::activeRadio($model , 'sts', ['class' =>'status'])?> //activeRadioList(‘實例化Model’, ‘字段’, ‘數組(鍵值)’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::activeRadioList($model,'sts' , [1=>'mrs' ,2=>'s' ] , ['class'=>'st'])?> 4)生成checkbox 及checkbox列表 //activeCheckbox(‘實例化Model’, ‘字段’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::activeCheckbox($model , 'sts' , ['class' => 'ckbox'])?> //activeCheckboxList(‘實例化Model’, ‘字段’, ‘數組(鍵值)’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::activeCheckboxList($model , 'sts',[1=>'f',2=>'m'], ['class'=>'ss'])?> 5)生成select下拉框 //activeDropDownList(‘實例化Model’, ‘字段’, ‘數組(鍵值)’ , ‘屬性例如class,id等’) <?=\yii\helpers\Html::activeDropDownList($model,'fg',[1=>'f',2=>'m'] , ['class'=>'sx'])?> 6、Html轉義和反轉義html代碼 <?php $html = ‘<b>test</b>’; //轉義html代碼 $thtml = \yii\helpers\Html::encode($html); //反轉義html代碼 $html = \yii\helpers\Html::decode($thtml); ?>
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看