【问题标题】:CakePHP 3 Error generator Plugin : [Cake\Core\Exception\MissingPluginException] Plugin could not be foundCakePHP 3 错误生成器插件:[Cake\Core\Exception\MissingPluginException] 找不到插件
【发布时间】:2017-07-30 22:51:29
【问题描述】:

链接我的问题:https://github.com/cakephp/cakephp/issues/10966

你做了什么

由控制台插件示例创建。

.\bin\cake bake plugin EOM/shop
.\bin\cake bake controller hola -p EOM/shop

//修改好bootstrap.php

Plugin::load('EOM/shop', ['bootstrap' => false, 'routes' => true]);

路由器插件:

Router::plugin(
    'EOM/shop',
    ['path' => '/e-o-m/shop'],
    function (RouteBuilder $routes) {
        $routes->fallbacks(DashedRoute::class);
    }
);

打印:DebugKit

打印:插件中的 My Tree 文件夹

发生了什么

浏览器错误:“发生内部服务器错误”

输出文件error.log

2017-07-30 21:33:13 Error: [Cake\Core\Exception\MissingPluginException] Plugin EOM/Shop could not be found.
Exception Attributes: array (
  'plugin' => 'EOM/Shop',
)
Request URL: /e-o-m/shop/hola
Stack Trace:
#0 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Core\App.php(190): Cake\Core\Plugin::classPath('EOM/Shop')
#1 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\View\View.php(1269): Cake\Core\App::path('Template', 'EOM/Shop')
#2 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\View\View.php(1087): Cake\View\View->_paths('EOM/Shop')
#3 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\View\View.php(592): Cake\View\View->_getViewFileName('Error\\error500')
#4 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Error\ExceptionRenderer.php(364): Cake\View\View->render('error500', 'error')
#5 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Error\ExceptionRenderer.php(341): Cake\Error\ExceptionRenderer->_outputMessageSafe('error500')
#6 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Error\ExceptionRenderer.php(200): Cake\Error\ExceptionRenderer->_outputMessage('missingControll...')
#7 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Error\Middleware\ErrorHandlerMiddleware.php(110): Cake\Error\ExceptionRenderer->render()
#8 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Error\Middleware\ErrorHandlerMiddleware.php(94): Cake\Error\Middleware\ErrorHandlerMiddleware->handleException(Object(Cake\Routing\Exception\MissingControllerException), Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#9 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Http\Runner.php(65): Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#10 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Http\Runner.php(51): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#11 D:\www\app.aptitud.local\www\vendor\cakephp\cakephp\src\Http\Server.php(80): Cake\Http\Runner->run(Object(Cake\Http\MiddlewareQueue), Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#12 D:\www\app.aptitud.local\www\webroot\index.php(37): Cake\Http\Server->run()
#13 {main}

你预期会发生什么

加载 ok my class my plugin 子文件夹 /app/plugins/EOM/Shop//app/plugins/MyCompany/Shop/

【问题讨论】:

    标签: php cakephp plugins cakephp-3.0


    【解决方案1】:

    检测问题, 解决方案很简单,在创建插件和控制器时要小心。因为这很容易,因为我总是以大写名称开头。

    通用修复示例:

    .\bin\cake bake plugin EOM/shop
    .\bin\cake bake controller hola -p EOM/shop
    

    无错误示例:

    .\bin\cake bake plugin EOM/Shop
    .\bin\cake bake controller Hola -p EOM/Shop
    

    加载类更改 bootstrap.php 没有问题

    Plugin::load('EOM/Shop', ['autoload' => true, 'bootstrap' => false, 'routes' => true]);
    

    或在控制台中执行,而不是在 bootstrap.php ['autoload' => true, ...] 中添加更改:

    php composer.phar dumpautoload

    【讨论】:

    • php composer.phar dumpautoload
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-02
    • 1970-01-01
    • 1970-01-01
    • 2017-10-26
    • 1970-01-01
    • 2015-08-20
    相关资源
    最近更新 更多