企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 6. 配置文件 ## 配置文件 插件配置文件用于给到用户自定义一些选项,用户安装后,可根据需要灵活配置你的插件。 目前支持text、textarea、radio、checkbox、select、image、images、date、datetime、array组件。 组件可前往这里了解:[字段类型与组件](Qian%20Yan.html) ## 配置后的效果 ![](https://img.kancloud.cn/c2/8e/c28e04b60cab5093e94592e01f2cab20_954x674.png) ## 文件路径 ``` <pre class="calibre16">``` addons ├─demo │ ├─Demo<span class="token1">.</span>php │ ├─config<span class="token1">.</span>php 配置文件 │ ├─info<span class="token1">.</span>ini ``` ``` ![](https://img.kancloud.cn/36/8f/368f09fc59379c5e6ead638d6fdcfdec_188x211.png) ## 无标签页示例 ``` <pre class="calibre16">``` <span class="token"><</span><span class="token">?</span>php <span class="token2">return</span> <span class="token1">[</span> <span class="token5">// 名称,保持唯一,获取时:$tmp['value1'] 即可获取value值。</span> <span class="token4">'value1'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'标题'</span><span class="token1">,</span> <span class="token5">// 标题</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'text'</span><span class="token1">,</span> <span class="token5">// 组件类型</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'提示'</span><span class="token1">,</span> <span class="token5">// 提示信息</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'required;length(3~16)'</span><span class="token1">,</span> <span class="token5">// 验证规则,可参考字段类型与组件下的验证规则,多个规则;隔开</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">'值必须'</span><span class="token1">,</span> <span class="token5">// 错误的提示信息</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token5">// 默认值</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value2'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'描述'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'textarea'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'radio'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'是否显示'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'radio'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span> <span class="token4">'options'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token5">// 选项</span> <span class="token4">'1'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'显示'</span><span class="token1">,</span> <span class="token4">'0'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'不显示'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'1'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'checkbox'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'多项选择'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'checkbox'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span> <span class="token4">'options'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token5">// key=>标题</span> <span class="token4">'1'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'显示1'</span><span class="token1">,</span> <span class="token4">'2'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'显示3'</span><span class="token1">,</span> <span class="token4">'0'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'不显示'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'1,2'</span> <span class="token5">// 多选时英文逗号分隔,对应选项key值</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'select'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'下拉选择'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'select'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'我是提示'</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span> <span class="token4">'options'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'1'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'测试1'</span><span class="token1">,</span> <span class="token4">'2'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'测试2'</span><span class="token1">,</span> <span class="token4">'3'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'测试3'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'2'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'array1'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'测试array组件'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'array'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span> <span class="token4">'data_list'</span><span class="token">=</span><span class="token">></span><span class="token1">[</span><span class="token5">// 键值名称</span> <span class="token4">'key'</span><span class="token">=</span><span class="token">></span><span class="token4">'标题'</span><span class="token1">,</span> <span class="token4">'value'</span><span class="token">=</span><span class="token">></span><span class="token4">'值'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'标题1'</span><span class="token">=</span><span class="token">></span><span class="token4">'2'</span><span class="token5">// 默认值</span> <span class="token1">]</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value1'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'动态下拉url类型'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'selectpage'</span><span class="token1">,</span> <span class="token5">// 动态下拉</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span> <span class="token4">'data_list'</span><span class="token">=</span><span class="token">></span><span class="token1">[</span> <span class="token4">'type'</span><span class="token">=</span><span class="token">></span><span class="token4">'url'</span><span class="token1">,</span><span class="token5">//链接地址类型</span> <span class="token4">'url'</span><span class="token">=</span><span class="token">></span><span class="token4">'/cms.flags/index'</span><span class="token1">,</span><span class="token5">//链接地址类型</span> <span class="token4">'show-field'</span><span class="token">=</span><span class="token">></span><span class="token4">'title'</span><span class="token1">,</span> <span class="token5">// 显示字段</span> <span class="token4">'key-field'</span><span class="token">=</span><span class="token">></span><span class="token4">'id'</span><span class="token1">,</span><span class="token5">// 存储字段</span> <span class="token4">'search-field'</span><span class="token">=</span><span class="token">></span><span class="token4">'title'</span><span class="token1">,</span><span class="token5">// 搜索字段</span> <span class="token4">'and-or'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span><span class="token5">// 值为and、或者or,search-field为多个时,值为and时表示同时成立反之其中一个成立即可</span> <span class="token4">'order-by'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span><span class="token5">// 排序:id desc,view asc</span> <span class="token4">'param'</span><span class="token">=</span><span class="token">></span><span class="token1">[</span> <span class="token4">'status'</span><span class="token">=</span><span class="token">></span><span class="token4">'normal'</span> <span class="token5">// 指定额外的条件</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'multiple'</span><span class="token">=</span><span class="token">></span><span class="token3">0</span><span class="token1">,</span><span class="token5">// 多选,1=开启,0=关闭</span> <span class="token4">'pagination'</span><span class="token">=</span><span class="token">></span><span class="token3">0</span><span class="token1">,</span><span class="token5">// 分页,1=开启,0=关闭</span> <span class="token4">'select-only'</span><span class="token">=</span><span class="token">></span><span class="token3">1</span><span class="token1">,</span><span class="token5">// 只读,1开启,0关闭</span> <span class="token4">'enable-lang'</span><span class="token">=</span><span class="token">></span><span class="token3">1</span><span class="token1">,</span><span class="token5">// 启用多语言区分,1开启,0关闭</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value2'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'动态下拉table类型'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'selectpage'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span> <span class="token4">'data_list'</span><span class="token">=</span><span class="token">></span><span class="token1">[</span> <span class="token4">'type'</span><span class="token">=</span><span class="token">></span><span class="token4">'table'</span><span class="token1">,</span><span class="token5">// 数据源来自数据库表</span> <span class="token4">'table'</span><span class="token">=</span><span class="token">></span><span class="token4">'flags'</span><span class="token1">,</span><span class="token5">// flags表,不用写表前缀</span> <span class="token4">'show-field'</span><span class="token">=</span><span class="token">></span><span class="token4">'title'</span><span class="token1">,</span> <span class="token4">'key-field'</span><span class="token">=</span><span class="token">></span><span class="token4">'id'</span><span class="token1">,</span> <span class="token4">'search-field'</span><span class="token">=</span><span class="token">></span><span class="token4">'title,name'</span><span class="token1">,</span> <span class="token4">'and-or'</span><span class="token">=</span><span class="token">></span><span class="token4">'or'</span><span class="token1">,</span> <span class="token4">'order-by'</span><span class="token">=</span><span class="token">></span><span class="token4">'id desc'</span><span class="token1">,</span> <span class="token4">'param'</span><span class="token">=</span><span class="token">></span><span class="token1">[</span> <span class="token4">'status'</span><span class="token">=</span><span class="token">></span><span class="token4">'normal'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'multiple'</span><span class="token">=</span><span class="token">></span><span class="token3">1</span><span class="token1">,</span><span class="token5">// 多选,1=开启,0=关闭</span> <span class="token4">'pagination'</span><span class="token">=</span><span class="token">></span><span class="token3">0</span><span class="token1">,</span><span class="token5">// 分页,1=开启,0=关闭</span> <span class="token4">'select-only'</span><span class="token">=</span><span class="token">></span><span class="token3">0</span><span class="token1">,</span><span class="token5">// 只读,1开启,0关闭</span> <span class="token4">'enable-lang'</span><span class="token">=</span><span class="token">></span><span class="token3">1</span><span class="token1">,</span><span class="token5">// 启用多语言区分,1开启,0关闭</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token1">]</span><span class="token1">,</span> <span class="token1">]</span><span class="token1">;</span> ``` ``` 效果图 ![](https://img.kancloud.cn/7c/06/7c06f516d55ea795d0556b5a8b7f050e_780x445.png) 如果配置项过多,可以使用下面方式,生成标签页 ## 标签页分组示例 使用标签页布局时,获取的配置结构是不一样的。 ``` <pre class="calibre16">``` <span class="token2">return</span> <span class="token1">[</span> <span class="token5">// 自定义名称,获取:$tmp['base']['value1'] </span> <span class="token4">'base'</span><span class="token">=</span><span class="token">></span><span class="token1">[</span> <span class="token5">// 标签页标题</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'基础配置'</span><span class="token1">,</span> <span class="token4">'item'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token5">// 标签页包含的配置项</span> <span class="token4">'value1'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'标题'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'text'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'提示'</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'required;length(3~16)'</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">'值必须'</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value2'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'描述'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'textarea'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'radio'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'是否显示'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'radio'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span> <span class="token4">'options'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'1'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'显示'</span><span class="token1">,</span> <span class="token4">'0'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'不显示'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'1'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'checkbox'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'多项选择'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'checkbox'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span> <span class="token4">'options'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'1'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'显示1'</span><span class="token1">,</span> <span class="token4">'2'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'显示3'</span><span class="token1">,</span> <span class="token4">'0'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'不显示'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'1,2'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'select'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'下拉选择'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'select'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'我是提示'</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span> <span class="token4">'options'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'1'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'测试1'</span><span class="token1">,</span> <span class="token4">'2'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'测试2'</span><span class="token1">,</span> <span class="token4">'3'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'测试3'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'2'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'selects'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'下拉多项选择'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'selects'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'我是提示'</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">''</span><span class="token1">,</span> <span class="token4">'options'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'1'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'测试1'</span><span class="token1">,</span> <span class="token4">'2'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'测试2'</span><span class="token1">,</span> <span class="token4">'3'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'测试3'</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'2,3'</span> <span class="token1">]</span> <span class="token1">]</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'more'</span><span class="token">=</span><span class="token">></span><span class="token1">[</span> <span class="token4">'title'</span><span class="token">=</span><span class="token">></span><span class="token4">'更多选项'</span><span class="token1">,</span> <span class="token4">'item'</span><span class="token">=</span><span class="token">></span><span class="token1">[</span> <span class="token4">'image'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'图片'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'image'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'请上传图片'</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'required'</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">'请上传图片'</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'images'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'图片'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'images'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'请上传图片'</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'required'</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">'请上传图片'</span><span class="token1">,</span> <span class="token4">'max_number'</span><span class="token">=</span><span class="token">></span><span class="token3">5</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'date'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'日期'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'date'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'required'</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">'日期选择'</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token1">]</span><span class="token1">,</span> <span class="token4">'datetime'</span> <span class="token">=</span><span class="token">></span> <span class="token1">[</span> <span class="token4">'title'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'日期时间'</span><span class="token1">,</span> <span class="token4">'type'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'datetime'</span><span class="token1">,</span> <span class="token4">'tips'</span> <span class="token">=</span><span class="token">></span> <span class="token4">'日期时间'</span><span class="token1">,</span> <span class="token4">'rules'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span><span class="token1">,</span> <span class="token4">'error_tips'</span><span class="token">=</span><span class="token">></span><span class="token4">'日期时间'</span><span class="token1">,</span> <span class="token4">'value'</span> <span class="token">=</span><span class="token">></span> <span class="token4">''</span> <span class="token1">]</span> <span class="token1">]</span> <span class="token1">]</span> <span class="token1">]</span><span class="token1">;</span> ``` ``` 效果 ![](https://img.kancloud.cn/e2/91/e2911da917fbfff236c175c9b3fa508b_781x499.png) ## 获取插件配置 ``` <pre class="calibre16">``` <span class="token5">/** * $type = 'template' 表示模板应用,$type='addon' 表示插件应用 * $name 插件标识名称 * $module 模板应用会用到,用于确定获取后台模板配置、或前台模板、或其他模块的模板。 * $complete true-表示获取所有结构数组,false-表示获取配置值 */</span> <span class="token6">get_addons_config</span><span class="token1">(</span>$type<span class="token1">,</span> $name<span class="token1">,</span> $module<span class="token1">,</span> $complete<span class="token1">)</span> <span class="token5">// 例如获取demo插件配置</span> <span class="token6">get_addons_config</span><span class="token1">(</span><span class="token4">'addon'</span><span class="token1">,</span><span class="token4">'demo'</span><span class="token1">)</span><span class="token1">;</span> ``` ``` ## 自定义配置页 如果系统自带的配置页,满足不了你的需求时,您可以自定义配置页,只需在自己的插件目录新建config.html即可。 ![](https://img.kancloud.cn/04/6a/046a1e441dbca5a46c7a0893ec438fbe_426x184.png) 在html页面获取的变量有:`$sdata` 里面的值结构就是你写的配置文件结构,你可参考默认的表单生成文件`template/admin/adminlte/appcenter/field.html`。 打印输出: ``` <pre class="calibre16">``` <span class="token"><</span><span class="token">?</span>php <span class="token6">dump</span><span class="token1">(</span>$sdata<span class="token1">)</span><span class="token1">;</span><span class="token">?</span><span class="token">></span> ``` ``` ![](https://img.kancloud.cn/91/c1/91c1d2024360a3a057793e7d3cef7f22_270x224.png) > 提示:若对自定义配置页仍有疑问,欢迎前往Q群咨询。