接口说明
接口 | 说明 | 类型 |
---|---|---|
svgIcon($type) | 重写项目svg 文件图标,传递$type 参数可以用来判断页面类型 | return |
header() | 网页head 区域接口 | echo |
footer() | 网页页脚(网页body 最下方)接口 | echo |
initJs() | 初始化js ,每次切换页面都会执行 | echo |
reJs() | js 重载函数 | echo |
开发
插件必要的两个文件为main.json
和index.php
,其中main.json
为插件信息介绍,index.php
为插件入口。
首先在插件目录下新建个文件夹,文件夹名字例如:helloworld
,然后在里面新建main.json
和index.php
文件。
mian.json
内容如下,插件名字可以与文件夹名字不一样。
{
"name": "插件名字",
"version": "版本号",
"description": "描述",
"author":"作者名",
"link":"作者链接"
}
index.php
这里首先要写个类,类名与文件夹名字要一致,比如下方例子就是helloworld
。
class helloworld{
public function 插件接口名字(){
//你的代码实现
}
}
插件设置,在类里面使用setting
函数即可如下例子,不写则没有插件设置界面
public function setting($settings){
//参数分别为 标题、描述、字段名、设置值(固定写法:$settings['你的字段名'] ?? NULL)、输入框预览文字
Input_Textarea('head区域插入内容', '通常用于插入统计代码或css文件', 'head', $settings['head'] ?? NULL,NULL);
Input_Textarea('页脚插入内容', '通常用于插入js文件', 'footer', $settings['footer'] ?? NULL,NULL);
Input_Btn('提交保存');
}
读取插件设置
$settings = pluginSettingRead('helloworld'); //获取插件配置
$head=$settings['head'] ?? NULL;