如何解决“无效的报头值:必须是字符串或字符串数​​组"在Laravel [英] How to fix "Invalid header value: must be a string or array of strings" in Laravel

查看:89
本文介绍了如何解决“无效的报头值:必须是字符串或字符串数​​组"在Laravel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地没有的产品服务器上遇到了问题. Laravel给我发送了一个错误,该错误指示一个标题问题.我认为这是一个Apache问题.

I have an issue on a prod server that I don't have in local. Laravel send me an error which says that there is a header issue. I think this is an Apache issue.

我在Mamp的本地计算机上工作. Laravel将OAuth与Laravel Passport一起使用.我已经在本地计算机上尝试过,并且可以正常工作.我也在Apache服务器上运行.

I work on my local machine with Mamp. Laravel is using OAuth with Laravel Passport. I've tried on my local machine and it's working. I'm running on a Apache server too.

在生产服务器上,只要我要登录我的应用程序,就会出现此错误:

On my production server, as soon as I want to login on my application, I have this error :

错误500:InvalidArgumentException,无效的标头值:必须为 字符串或字符串数​​组;不能为空数组.

ERROR 500 : InvalidArgumentException, Invalid header value: must be a string or array of strings; cannot be an empty array.

它在Laravel Zendframwork供应商的MessageTrait.php line 389中.

And it's in MessageTrait.php line 389 from Laravel Zendframwork vendor.

也许这只是服务器上的一个模块?

Maybe it's just a module on the server ?

谢谢

推荐答案

我遇到了同样的问题,我的解决方案是将下一个软件包降级到该特定版本,因为那是我的项目中正在使用的版本:

I was having the same problem, my solution was to downgrade the next packages to that specific version because that was the version that was working in my project:

composer require symfony/http-kernel:3.4.20
composer require symfony/http-foundation:3.4.20
composer require symfony/psr-http-message-bridge:1.1.0

我希望它对您有用.

这篇关于如何解决“无效的报头值:必须是字符串或字符串数​​组"在Laravel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆