Laravel:array_merge():参数 #2 不是数组错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25575217/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel: array_merge(): Argument #2 is not an array error
提问by Deepak Thomas
Exceptions started to appear in all views, and when I try to run composer update
, it always ends up with
异常开始出现在所有视图中,当我尝试运行时composer update
,它总是以
{"error":{"type":"ErrorException","message":"array_merge(): Argument #2 is not an array","file":"\/laravel\/framework\/src\/Illuminate\/Foundation\/ProviderRepository.php","line":188}}
回答by Deepak Thomas
After a lot of searching and exploring each file in the 'app' folder, it appears that one file was corrupt
经过大量搜索和探索“app”文件夹中的每个文件后,似乎有一个文件已损坏
Deleteapp/storage/meta/services.jsonand re-run composer update
and this should solve it.
删除app/storage/meta/ services.json并重新运行composer update
,这应该可以解决它。
回答by Tahsin Abrar
Sometimes only deleting app/storage/meta/services.json
and run composer update
doesn't solve the ERROR: array_merge(): Argument #2 is not an array error
. At least in my case, it didn't.
有时仅删除app/storage/meta/services.json
并运行composer update
并不能解决 ERROR: array_merge(): Argument #2 is not an array error
。至少在我的情况下,它没有。
Most of the time it happens when you're screwing up the bootstrap/cache/services.json
file. And running composer update
will not generate services.json
file.
大多数情况下,当您搞砸bootstrap/cache/services.json
文件时会发生这种情况。并且运行composer update
不会生成services.json
文件。
To generate the services.json
file, you need to delete the previous bootstrap/cache/services.json
file and run php artisan serve
. Then it'll generate a fresh services.json` file.
要生成该services.json
文件,您需要删除以前的bootstrap/cache/services.json
文件并运行php artisan serve
. 然后它会生成一个新的 services.json` 文件。
Hope it helps to someone!
希望它对某人有所帮助!
回答by fico7489
- delete bootstrap folder
- git reset --hard
- composer install
- done
- 删除引导文件夹
- git reset --hard
- 作曲家安装
- 完毕
回答by Andy
I had similar problem with a fresh install.
我在全新安装时遇到了类似的问题。
I solved it like this:
Removed bootsrap/cache/**services.php**
and then i
surfed to the website with browser, it generated a new services.php and then it worked.
我是这样解决的:删除bootsrap/cache/**services.php**
然后我用浏览器浏览网站,它生成了一个新的 services.php 然后它工作了。
回答by Sad?k Menduh A?ar
I solved it:
我解决了:
open This folder-->/Applications/MAMP/htdocs/*****/vendor/laravel/framework/src/Illuminate/View/Factory.php
打开这个文件夹-->/Applications/MAMP/htdocs/*****/vendor/laravel/framework/src/Illuminate/View/Factory.php
and comment this line
并评论这一行
//$data = array_merge($mergeData, $this->parseData($data));
line number -> 136.
行号 -> 136。
回答by Alex Celmer
You probably just forgot to put compact('var') as the second return view argument
您可能只是忘记将 compact('var') 作为第二个返回视图参数
return view("path.to.view", compact ('var'))
返回视图(“path.to.view”,紧凑('var'))
回答by Ariful Haque
Just a composer update
worked for me.
只是composer update
对我有用。