创建插件
步骤 1:创建插件目录
public/plugin/MyPlugin/步骤 2:定义插件类
<?php
class MyPluginPlugin extends Plugin
{
protected function __construct()
{
$settings = [
'tool_enable' => 'boolean',
'api_key' => 'text',
];
parent::__construct('1.0', 'Your Name', $settings);
}
public static function create(): static
{
static $instance = null;
return $instance ??= new static();
}
}可用的配置类型
类型
描述
步骤 3:创建 plugin.php 文件
步骤 4:创建安装和卸载脚本
步骤 5:添加翻译
步骤 6:通过显示区域注入内容
步骤 7:响应平台事件(可选)
步骤 8:生命周期钩子
方法
触发时机
步骤 9:激活
小贴士
最后更新于
这有帮助吗?