Skip to content

插件视图模板路径问题 #14

@mini-content

Description

@mini-content

tp6框架下使用时会出现路径问题,会由原来的addons下插件内的view文件夹变成根目录下的view文件夹
暂时的解决方案:
/** * 插件构造函数 * Addons constructor. * @param \think\App $app */ public function __construct(App $app) { $this->app = $app; $this->request = $app->request; $this->name = $this->getName(); $this->addon_path = $app->addons->getAddonsPath() . $this->name . DIRECTORY_SEPARATOR; $this->addon_config = "addon_{$this->name}_config"; $this->addon_info = "addon_{$this->name}_info"; $this->view = clone View::engine('Think'); $this->view->config([ 'view_path' => $this->addon_path . 'view' . DIRECTORY_SEPARATOR ]); // 控制器初始化 $this->initialize(); }
去除此段代码内的 clone

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions