Php CodeIgniter:使用HTML5必需属性的输入框
我在CodeIgniter框架中有一个表单,我想使用HTML“required”属性。 我该怎么做Php CodeIgniter:使用HTML5必需属性的输入框,php,codeigniter,Php,Codeigniter,我在CodeIgniter框架中有一个表单,我想使用HTML“required”属性。 我该怎么做 $data = array( 'name' => 'username', 'id' => 'username', 'value' => 'johndoe', 'maxlength' => '100',
$data = array(
'name' => 'username',
'id' => 'username',
'value' => 'johndoe',
'maxlength' => '100',
'size' => '50',
'style' => 'width:50%',
);
echo form_input($data);
所需的结果:
<input type="text" name="username" id="username" value="johndoe"
required maxlength="100" size="50" style="width:50%" />
只需将其添加到阵列中即可
$data = array(
'name' => 'username',
'id' => 'username',
'value' => 'johndoe',
'maxlength' => '100',
'size' => '50',
'style' => 'width:50%',
'required' => 'required'
);
echo form_input($data);
不太熟悉codeigniter,但您不能只做
“必需的”=>“必需的”
?请将其设置为ans。。我需要给你+1本书,就像有人已经发布了一样,没有必要复制答案:pthaanx。。它解决了。。但在过去或现在,我并没有读到“必选=必选”。我总是读“必选”。所以我问了一个问题。