RouteRegistrar.php第75行中的Laravel InvalidArgumentException:

时间:2017-02-27 09:23:33

标签: php laravel invalidargumentexception

尝试将laravel应用程序部署到生产服务器时,我一直收到此错误:

InvalidArgumentException in RouteRegistrar.php line 75:

in RouteRegistrar.php line 75
at RouteRegistrar->attribute('after', object(AfterFilter)) in Router.php line 1085
at Router->__call('after', array(object(AfterFilter))) in BootProviders.php line 17
at Router->after(object(AfterFilter)) in BootProviders.php line 17
at Application->boot() in BootProviders.php line 17
at BootProviders->bootstrap(object(Application)) in Application.php line 208
at Application->bootstrapWith(array('Illuminate\\Foundation\\Bootstrap\\LoadEnvironmentVariables', 'Illuminate\\Foundation\\Bootstrap\\LoadConfiguration', 'Illuminate\\Foundation\\Bootstrap\\HandleExceptions', 'Illuminate\\Foundation\\Bootstrap\\RegisterFacades', 'Illuminate\\Foundation\\Bootstrap\\RegisterProviders', 'Illuminate\\Foundation\\Bootstrap\\BootProviders')) in Kernel.php line 160
at Kernel->bootstrap() in Kernel.php line 144
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 54

奇怪的是我在本地计算机上没有收到此错误。我的机器和生产服务器的PHP版本几乎相同(服务器上为5.6.25,机器上为5.6.26)。

有没有人知道可能导致此错误的原因是什么?

2 个答案:

答案 0 :(得分:1)

此异常应抛出import simplejson with open ('automation.json')as json_data: data = simplejson.loads(json_data) for r in data['messages']: key = messages['icon'] messages["icon"] = ("testing") outdata = simplejson.dumps(data) 之类的消息,您需要找到此密钥并进行修复。您似乎没有使用正确的密钥名称,您可以找到允许的密钥名称here

Attribute [{$key}] does not exist.

抛出此异常的方法是RouteRegistrar.php文件中的protected $allowedAttributes = [ 'as', 'domain', 'middleware', 'name', 'namespace', 'prefix', ];

答案 1 :(得分:1)

经过一些研究后,问题的根源似乎是安装在服务器上的旧版本的New Relic。 https://discuss.newrelic.com/t/php-agent-breaks-laravel-5-2/32801