【CI form html格式】:
~~~
<form>
<fieldset>
<legend>表单</legend>
<div class="form-group">
<label for="exampleInputEmail1">Email</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Email">
</div>
<div class="form-group">
<label for="exampleInputEmail1">Password</label>
<input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Password">
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button type="submit" class="btn btn-default">Submit</button>
<button type="reset" class="btn btn-primary">Reset</button>
</div>
</div>
</fieldset>
</form>
~~~
【对应的CI form格式】:
~~~
<?php echo form_open("", ['class'=>'form-horizontal']); ?>
<fieldset>
<legend>表单</legend>
<div class="form-group">
<label for="exampleInputEmail1">Email</label>
<?php echo form_input(['name'=>'username', 'class'=>'form-control', 'placeholder'=>'Email']); ?>
</div>
<div class="form-group">
<label for="exampleInputEmail1">Password</label>
<?php echo form_input(['name'=>'password', 'class'=>'form-control', 'placeholder'=>'Password']); ?>
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<?php echo form_submit(['value'=>'Submit', 'class'=>'btn btn-primary']); ?>
<?php echo form_reset(['value'=>'Reset', 'class'=>'btn btn-default']); ?>
</div>
</div>
</fieldset>
<?php echo form_close(); ?>
~~~