# 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群咨询。
- 简介
- 下载与安装配置
- 下载
- 虚拟主机安装
- 百度云虚拟主机
- 创业云虚拟主机
- Linux下宝塔安装
- 宝塔一键部署
- Windows下宝塔安装
- phpEnv下安装
- phpStudy下安装
- 伪静态(url重写)
- 安装系统
- 调试模式与env文件
- 重新安装与安装文件说明
- 后台使用帮助
- 后台入口文件
- 首页面板
- 配置中心
- 站点配置
- SEO设置
- SEO设置-静态生成
- 文档属性
- 站点模块
- V2.2.2版本 -
- V2.2.3版本 +
- 模型管理
- 栏目管理
- 字段类型与组件
- 前言
- 前端组件
- 验证规则
- text 单行文本
- textarea 多行文本
- radio 单选
- checkbox 复选
- select 下拉列表
- selects下拉列表(多)
- selectpage 动态下拉
- editor编辑器
- image图片
- images图片(多)
- number数字
- date日期
- datetime日期和时间
- downfile文件上传
- downfiles文件上传(多)
- array 数组(键值对)
- 内容管理
- 自定义URL
- 多语言
- 界面多语言
- 内容多语言
- 多语言URL地址
- 附件管理
- 应用中心
- 标签语法
- 标签使用必读
- 列表标签
- content 内容列表标签
- contentpage 内容列表分页
- wfpage 瀑布流分页
- filter 筛选标签
- order 排序标签
- 内容标签
- guestbook 留言(表单)标签(废弃)
- form 表单标签
- pre 上一篇标签
- next 下一篇标签
- prenext 上一篇下一篇(高级)标签
- fileinfo 获取附件信息(文件下载)
- 内容分页
- raw 格式化编辑器文本(即将废弃)
- 全局标签
- seo 标签
- channel 栏目标签
- arcone 获取单条文档
- breadcrumb 面包屑导航标签
- adv 站点模块标签
- date 日期格式化标签
- substr字符(标题)截取标签
- volist 循环标签
- language 获取语言列表标签
- query 查询数据库内容
- include 导入模板文件标签
- 原生PHP与php标签
- map生成位置地图
- thumb 生成缩略图
- addons 插件检测
- 标签管理
- taglist标签(获取标签列表)
- tagarclist根据标签获取文章内容列表
- 导入标签
- 模板开发
- 1. 创建模板
- 2. 模板目录结构
- 3. 模板描述文件(重要) info.ini
- 4. 变量输出格式
- 4. 模板变量
- 5. 获取站点配置
- 6. 模板界面多语言
- 7. 模板静态目录及调用静态文件
- 8. 模板定义插件事件
- 9. 模板搜索页
- 10. 模板配置JSON
- 11. 导入演示数据
- 12. 卸载删除演示数据
- 13. 模板文件打包
- 14. 整站源码打包
- 插件开发
- 1. 创建插件
- 2. 目录结构
- 3. 插件名称类
- 4. 插件信息(info.ini)
- 5. 插件事件
- 6. 配置文件
- 7. install 安装目录
- 8. 创建菜单
- 9. 插件控制器
- 10. 插件视图
- 10-1 插件主题化
- 11. 插件模型
- 12. 模型事件
- 13. 插件内置函数
- 13-1 插件函数库
- 14. 插件多语言
- 15. 插件中间件
- 16. 插件路由
- 17. 插件验证器
- 18. 标签库
- 19. 第三方类库
- 20. 数据库文件导入
- 插件打包
- 后台前端使用帮助
- 二次开发帮助(更新中)
- 后台前端开发帮助
- 路由(链接地址、访问规则)
- URL访问
- 路由定义
- URL生成
- 附录
- 数据字典
- 助手函数库