Laravel array_merge():参数#2不是ServiceProvider.php中的数组

问题描述 投票:0回答:2

我不能再做php工匠服务,它说:

在ServiceProvider.php第59行:

   array_merge(): Argument #2 is not an array

第59行代码在ServiceProvider.php中:

$this->app['config']->set($key, array_merge(require $path, $config));

我不明白我的ServiceProvider.php有什么问题,我没有改变那里的东西。

我希望有些人可以帮助我。

php laravel laravel-5 array-merge
2个回答
3
投票

试试这个

在这里使用is_array方法。

$this->app['config']->set($key, array_merge(require $path, is_array($config) ? $config : [$config]))

is_array($config) ? $config : [$config]

如果不希望更改框架文件检查qazxsw poi文件夹中的配置文件,则文件返回单个值而不是数组(必须是返回数组)


3
投票

检查config文件夹中的文件,其中一个文件没有返回数组。

© www.soinside.com 2019 - 2024. All rights reserved.