• Yii使用layui中两种展示表单的方式


    1使用yii2默认的

    <div class="layui-card-body ">
        <?php
              $form = ActiveForm::begin([
                   'id' => 'msg-form',
                    'options' => ['class'=>'layui-form'],
                    'enableAjaxValidation'=>false,
                    'fieldConfig' => [
                        'template' => '
                            <div class="layui-form-item">
                                {label}
                                <div class="layui-input-inline">
                                    {input}
                                </div>
                                <div class="layui-form-mid layui-word-aux">
                                    {error}
                                </div>
                            </div>',
                        'labelOptions' => ['class' => 'layui-form-label'],
                    ]
              ]);
          ?>
          <?php echo $form->field($model, 'username')->textInput(['class' => 'layui-input']); ?>
          <?php echo $form->field($model, 'password_hot')->passwordInput(['class' => 'layui-input']); ?>
          <?php echo $form->field($model, 'repass_hot')->passwordInput(['class' => 'layui-input']); ?>
          <?php echo $form->field($model, 'email')->textInput(['class' => 'layui-input']); ?>
          <div class="layui-form-item">
              <label class="layui-form-label">是否启用</label>
              <div class="layui-input-block">
                <input type="radio" name="status" value="1" title="是" checked=""><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon">�</i><div>是</div></div>
                <input type="radio" name="status" value="0" title="否"><div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon">�</i><div>否</div></div>
              </div>
          </div>
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label"></label>
              <?php echo Html::submitButton('新增', ['class' => 'layui-btn']); ?>
          </div>
          <?php ActiveForm::end(); ?>
    </div>

    第二种,使用后台模板的

    <div class="layui-card-body ">
          <form class="layui-form" action="<?php echo yiihelpersUrl::to(['create'])?>" method="post">
             <input type="hidden" name="<?= Yii::$app->request->csrfParam; ?>" value="<?= Yii::$app->request->getCsrfToken();?>">
             <div class="layui-form-item">
                 <label for="" class="layui-form-label">用户名</label>
                 <div class="layui-input-inline">
                     <input type="text" value="<?php echo $model->username; ?>" name="username" placeholder="请输入用户名" class="layui-input" maxlength="16" >
                 </div>
                 <?php if ($model->hasErrors('username')): ?>
                 <div class="layui-form-mid layui-word-aux"><?php echo $model->getFirstError('username'); ?></div>
                 <?php endif;?>
             </div>
    
             <div class="layui-form-item">
                 <label class="layui-form-label">是否启用</label>
                 <div class="layui-input-block">
                   <input type="radio" name="status" value="1" title="是" checked=""><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon">�</i><div>是</div></div>
                   <input type="radio" name="status" value="0" title="否"><div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon">�</i><div>否</div></div>
                 </div>
             </div>
             <div class="layui-form-item">
                 <label for="" class="layui-form-label"></label>
                 <div class="layui-input-block">
                     <button type="submit" lay-submit lay-filter="*" class="layui-btn layui-btn-sm">确定</button>
                     <a href="<?php echo yiihelpersUrl::to(['index'])?>" class="layui-btn layui-btn-sm">返回</a>
                 </div>
             </div>
          </form>
    </div>
  • 相关阅读:
    jenkins配置html报告
    JMeter并发测试(设置集合点)
    jmeter压力测试 设置一秒发送一次请求,一秒两次请求
    jmeter压力测试的简单实例+badboy脚本录制
    JMeter问题集
    英语自然拼读法基本规则和小窍门
    Jmeter工具做性能测试 常见的错误汇总
    如何使用JDK自带工具JConsole
    第七章 JMeter 逻辑控制器
    第六篇:JMeter 断言
  • 原文地址:https://www.cnblogs.com/seanpan/p/13993070.html
Copyright © 2020-2023  润新知