1

如何通过远程文件夹将插件映射到 cakephp 3.7?

在 3.4 版之后,我不再能够加载插件,我查看了文档并检查了它是否已经使用 Application :: addplugin (); 尝试了更改;和应用程序::bootstrap(); 那是我找到的解决方案,我不知道我是否需要做更多的程序,或者其他一些语法是否已经改变。

4

1 回答 1

0

来自 CakePHP 文档:

插件外壳允许您通过命令提示符加载和卸载插件。如果您需要帮助,请运行:

bin/cake plugin --help

加载插件

通过 Load 任务,您可以在 config/bootstrap.php 中加载插件。您可以通过运行:

bin/cake plugin load MyPlugin

这会将以下内容添加到您的 src/Application.php 中:

// In the bootstrap method add:
$this->addPlugin('MyPlugin');

// Prior to 3.6, add the following to config/bootstrap.php
Plugin::load('MyPlugin');

如果您在引导程序中的任何方法/事件之前需要插件,则使用如下:

class Application extends BaseApplication
    {
        /**
         * {@inheritDoc}
         */
        public function bootstrap()
        {
            $this->addPlugin('OAuthServer', ['routes' => true]);

            // Call parent to load bootstrap from files.
            parent::bootstrap();

            if (PHP_SAPI === 'cli') {
                try {
                    $this->addPlugin('Bake');
                } catch (MissingPluginException $e) {
                    // Do not halt if the plugin is missing
                }

                $this->addPlugin('Migrations');
            }

            /*
             * Only try to load DebugKit in development mode
             * Debug Kit should not be installed on a production system
             */
            if (Configure::read('debug')) {
                $this->addPlugin(\DebugKit\Plugin::class);
            }

            // Other plugins
            $this->addPlugin('BootstrapUI');
            $this->addPlugin('Search');

阅读更多:

https://book.cakephp.org/3.0/en/console-and-shells/plugin-shell.html

于 2019-05-27T07:36:22.627 回答