表单生成类

属性
命名空间 fize\tag
类名 Form
父类 fize\tag\Html
方法:
方法名 说明
input() 创建input标签
textarea() 创建textarea标签
button() 创建button标签
select() 创建select标签
optgroup() 创建optgroup标签
option() 创建option标签
label() 创建label标签
datalist() 创建datalist标签
keygen() 创建keygen标签
output()  
createTag() 创建标签

方法

input()

创建input标签

public static function input (
    string $type,
    string $name = null,
    string $value = "",
    array $attrs = []
) : string
参数:
名称 说明
type 类型
name 名称
value
attrs 属性

textarea()

创建textarea标签

public static function textarea (
    string $name = null,
    string $text = "",
    array $attrs = []
) : string
参数:
名称 说明
name 名称
text 文本内容
attrs 属性

button()

创建button标签

public static function button (
    string $text = "",
    string $name = null,
    string $value = null,
    string $type = "button",
    array $attrs = []
) : string
参数:
名称 说明
text 文本
name 名称
value
type 类型
attrs 属性

select()

创建select标签

public static function select (
    string $name = null,
    string $selecteds = null,
    array $options = [],
    array $attrs = [],
    bool $is_group = false
) : string
参数:
名称 说明
name 名称
selecteds 选中值,多选以数组形式表示
options 选项
attrs 属性
is_group 参数$options是否为optgroup标签

optgroup()

创建optgroup标签

public static function optgroup (
    string $label,
    array $options,
    array $attrs = [],
    mixed $selecteds = null
) : string
参数:
名称 说明
label 描述
options option选项
attrs 属性
selecteds 选中项,多选以数组形式表示

option()

创建option标签

public static function option (
    string $text = "",
    string $value = "",
    bool $selected = false,
    array $attrs = []
) : string
参数:
名称 说明
text 文本
value
selected 是否选中
attrs 属性

label()

创建label标签

public static function label (
    string $text,
    string $for = null,
    array $attrs = []
) : string
参数:
名称 说明
text 文本
for 规定 label 绑定到哪个表单元素
attrs 属性

datalist()

创建datalist标签

public static function datalist (
    string $id,
    array $options,
    array $attrs = [],
    mixed $selecteds = null
) : string
参数:
名称 说明
id ID
options option选项
attrs 属性
selecteds 选中项,多选以数组形式表示

keygen()

创建keygen标签

public static function keygen (
    string $name = null,
    string $keytype = "rsa",
    array $attrs = []
) : string
参数:
名称 说明
name 名称
keytype 定义 keytype。rsa 生成 RSA 密钥。
attrs 属性

output()

public static function output (
    null $name = null,
    mixed $for = null,
    string $text = "",
    array $attrs = []
) : string
参数:
名称 说明
name  
for 定义输入字段所属的一个或多个表单,多个可以以数组形式传入
text 文本
attrs 属性

createTag()

创建标签

public static function createTag (
    string $tag,
    array $attrs = [],
    bool $close = false,
    string $text = ""
) : string
参数:
名称 说明
tag 标签名
attrs 属性
close 是否闭合
text 显示字符串
返回值:

返回HTML代码段