test111111111111111112222222222222
```python def hello(): print("Hello, Markdown!") ```test
this is code block testing ..this is code block testing ..
正确的 Cap_Plugin 模板(Docker + Typecho 可用)
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
use Typecho\Plugin\PluginInterface;
use Typecho\Widget\Helper\Form;
class Cap_Plugin implements PluginInterface
{
// 插件激活
public static function activate() {
return "Cap 插件启用成功";
}
// 插件禁用
public static function deactivate() {
return "Cap 插件已禁用";
}
// 插件配置(必须有这个方法)
public static function config(Form $form) {
// 可以添加配置项,如果没有,可留空
}
// 用户个人设置
public static function personalConfig(Form $form) {
// 可留空
}
// 插件前端输出
public static function output() {
echo '<p>Cap 验证码测试</p>';
}
}⚠️ 注意:
- 文件路径
/plugins/Cap/Plugin.php - 类名
Cap_Plugin - 方法
config(Form $form)必须存在。
操作步骤
- 替换
/plugins/Cap/Plugin.php内容为上面模板。 - 清除缓存:
rm -rf /app/usr/plugins/__typecho.cache- 后台刷新插件页面,再启用 Cap 插件。
- 如果显示“启用成功”,就可以在 comment-input.php 中调用:
<?php if (class_exists('Cap_Plugin')): ?>
<?php Cap_Plugin::output(); ?>
<?php endif; ?>我可以帮你写一个 完整可在 Docker Typecho 上直接使用的 Cap 插件模板 + 前端调用示例,保证后台启用无报错并显示验证码。
Copyright Notice: This article is an original work. Copyright belongs to Will's Blog. Please contact the author for permission before reprinting.
Article URL: https://loopback0.1amwill.com/archives/3/
If you have any questions or concerns about this article, feel free to leave a comment. I will try my best to respond as soon as possible.
暂无标签
🍎🍊🍎🍐🍋🥥🥩🥪🍳🥓
sdsdsdsd
sdsdsdsd
sdsdsd