答案 0 :(得分:1)
尝试使用此代码:
注意:首先在form_helper
或控制器中加载autoload.php
假设复选框名称是用户名
<?=form_label(form_checkbox('username','',['checked' => TRUE]).'<span class="slider round"></span>','username',['class' => 'color']);?>
输出:
<label for="username" class="color">
<input type="checkbox" name="username" value="" checked="checked" />
<span class="slider round"></span>
</label>
更多信息:https://www.codeigniter.com/userguide3/helpers/form_helper.html