Creates a radio form input.
echo Form::radio('like_cats', 1, $cats);
echo Form::radio('like_cats', 0, !$cats);
string Core_Form::radio( string $name [, string $value = null , boolean $checked = bool false , array $attributes = null ] )
参数列表
参数 类型 描述 默认值 $name
string
Input name $value
string
Input value null $checked
boolean
Checked status bool false $attributes
array
Html attributes null
string
public static function radio($name, $value = null, $checked = false, array $attributes = null)
{
$attributes['type'] = 'radio';
if (true===$checked)
{
// Make the radio active
$attributes['checked'] = 'checked';
}
return Form::input($name, $value, $attributes);
}