Skip to content

laravel在配置中用闭包,生成缓存时报错 #50

@dengdan99

Description

@dengdan99

非常喜欢您的apidoc,已经在很多项目上部署了,我发现一个问题,当在配置中使用闭包的时候会导致一些错误。
例如:

'auto_url' => [
        'handle_key'=>function($key){
            // 此例子是tp6开启控制器后缀配置后,用来将Controller去除。
            return str_ireplace('Controller', "", $key);
        }
        // (选配)自定义url生成方法
        'custom' =>function($path,$method){
            //此处根据需求自行实现
            return "/".str_replace('\\','/',$$path).$method;
        },
    ],

在laravel框架中如果使用命令生成缓存就会报错,原因是laravel不支持闭包的配置,希望通过方法配置类来实现
如:

'auto_url' => [
        'handle_class_key'=>\Namespace\Handler::class,
],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions