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
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