方法:
~~~
tpl_form_option($name, $title, $value = [], $help_text = '', $type = 'text', $attr = [], $extra_class = 'layui-input', $extra_attr = [], $extra_css = [])
~~~
参数描述:
| 参数 | 名称 | 变量类型 |
| --- | --- | --- |
| name | 表单name值 | string |
| title | 表单描述 | string |
| value | 默认值 | array |
| default | 默认值 | string |
| help\_text | 帮助文本 | string |
| extra\_attr | 额外属性 | string |
| type | 类型,默认text,参考[html5](https://www.kancloud.cn/onegow_/onegowcms/%5B%E9%93%BE%E6%8E%A5%5D(http://www.w3school.com.cn/html5/html_5_form_input_types.asp)) | string |
| extra\_class | 属性 | string |
| extra\_css | 额外css | string |
| attr | 属性,详见下表 | array |
代码示例:
~~~
<?php echo tpl_form_option('aaa','哈哈大笑',['温州' => 0,'厦门' => 0,'福州'=>1,'杭州'=>0]); ?>
~~~
效果图:
![](https://git.kancloud.cn/repos/caike_/wq_frame/raw/b46bdc3ca04f2c2d269b313cae88d5a7ca837c14/images/%E5%8D%95%E8%A1%8C%E9%80%89%E6%8B%A9%E6%A1%86.png?access-token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1ODc0MDg0NTIsImlhdCI6MTU4NzM2NTI1MiwicmVwb3NpdG9yeSI6ImNhaWtlX1wvd3FfZnJhbWUiLCJ1c2VyIjp7InVzZXJuYW1lIjoieWhsMTgiLCJuYW1lIjoiTXJZZTU4NjkiLCJlbWFpbCI6IjU1NTg1MTkwQHFxLmNvbSIsInRva2VuIjoiNzE1MTdkYjM3ODBkMjIwNjI3NTk5ZTIzNGU0YThmOTYiLCJhdXRob3JpemUiOnsicHVsbCI6dHJ1ZSwicHVzaCI6dHJ1ZSwiYWRtaW4iOnRydWV9fX0.J8UpRlTnE5Y5M6P7EkjuqpLGrCv3SEJs3zdcT_SFAGw)