如何通过远程文件夹将插件映射到cakephp 3.7中?
在版本3.4之后,我不再能够加载插件,我查看了文档,并检查它是否已经使用Application ::addplugin ()和Application ::bootstrap ()进行了更改;这是我找到的解决方案,我不知道是否需要执行更多的过程,或者其他语法是否已经改变。
发布于 2019-05-27 07:36:22
来自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
https://stackoverflow.com/questions/56318223
复制相似问题