Pugin.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2020/1/14
  6. * Time: 17:05
  7. */
  8. namespace addons\text;
  9. use think\Addons;
  10. /**
  11. * Class Pugin
  12. * @package addons\text
  13. */
  14. class Pugin extends Addons
  15. {
  16. // 该插件的基础信息
  17. public $info = [
  18. 'name' => 'test', // 插件标识
  19. 'title' => '插件测试', // 插件名称
  20. 'description' => 'thinkph6插件测试', // 插件简介
  21. 'status' => 0, // 状态
  22. 'author' => 'byron sampson',
  23. 'version' => '0.1'
  24. ];
  25. /**
  26. * 插件安装方法
  27. * @return bool
  28. */
  29. public function install()
  30. {
  31. // TODO: Implement install() method.
  32. return true;
  33. }
  34. /**
  35. * 插件卸载方法
  36. * @return bool
  37. */
  38. public function uninstall()
  39. {
  40. // TODO: Implement uninstall() method.
  41. return true;
  42. }
  43. /**
  44. * 实现的testhook钩子方法
  45. * @return mixed
  46. */
  47. public function testhook($param)
  48. {
  49. // 调用钩子时候的参数信息
  50. print_r($param);
  51. // 当前插件的配置信息,配置信息存在当前目录的config.php文件中,见下方
  52. print_r($this->getConfig());
  53. // 可以返回模板,模板文件默认读取的为插件目录中的文件。模板名不能为空!
  54. return $this->fetch('info');
  55. }
  56. }