我有一条类似的路线
http://localhost/inspection/show/{id}
当我尝试同时加载路线时。在不同的选项卡中,有时其中一些选项卡会出现错误"哇,看起来好像出了问题">
在不同的选项卡中加载,速度如此之快
http://localhost/inspection/show/8
http://localhost/inspection/show/9
http://localhost/inspection/show/10
http://localhost/inspection/show/11
堆栈跟踪有这个
[2015-08-06 14:57:53] local.ERROR: exception 'RuntimeException' with message 'No supported encrypter found. The cipher and / or key length are invalid.' in C:wampwwwiaservervendorlaravelframeworksrcIlluminateEncryptionEncryptionServiceProvider.php:29
Stack trace:
#0 C:wampwwwiaservervendorlaravelframeworksrcIlluminateContainerContainer.php(733): IlluminateEncryptionEncryptionServiceProvider->IlluminateEncryption{closure}(Object(IlluminateFoundationApplication), Array)
#1 C:wampwwwiaservervendorlaravelframeworksrcIlluminateContainerContainer.php(626): IlluminateContainerContainer->build(Object(Closure), Array)
#2 C:wampwwwiaservervendorlaravelframeworksrcIlluminateFoundationApplication.php(674): IlluminateContainerContainer->make('encrypter', Array)
#3 C:wampwwwiaservervendorlaravelframeworksrcIlluminateContainerContainer.php(837): IlluminateFoundationApplication->make('Illuminate\Cont...')
#4 C:wampwwwiaservervendorlaravelframeworksrcIlluminateContainerContainer.php(800): IlluminateContainerContainer->resolveClass(Object(ReflectionParameter))
#5 C:wampwwwiaservervendorlaravelframeworksrcIlluminateContainerContainer.php(771): IlluminateContainerContainer->getDependencies(Array, Array)
#6 C:wampwwwiaservervendorlaravelframeworksrcIlluminateContainerContainer.php(626): IlluminateContainerContainer->build('IAServer\Http\M...', Array)
#7 C:wampwwwiaservervendorlaravelframeworksrcIlluminateFoundationApplication.php(674): IlluminateContainerContainer->make('IAServer\Http\M...', Array)
#8 C:wampwwwiaservervendorlaravelframeworksrcIlluminateFoundationHttpKernel.php(143): IlluminateFoundationApplication->make('IAServer\Http\M...')
#9 C:wampwwwiaserverpublicindex.php(58): IlluminateFoundationHttpKernel->terminate(Object(IlluminateHttpRequest), Object(IlluminateHttpResponse))
#10 {main}
env文件是正确的,我重新运行php-artisan密钥:生成
APP_ENV=local
APP_DEBUG=true
APP_KEY=UC5Fsvi8JsGG4U72k04rS3o5csiINDYB
但只有当路由快速加载不同的id时,错误才会出现。
为什么?
我解决了,有时laravel没有在.ENV中读取APP_KEY。并返回一个值"SomeRandomString"(默认值在config/APP.php中定义(,并出现错误"密钥长度无效",所以解决方案是将APP_KEY的值复制到config/APP.hp中的值"KEY",仅此而已!我解决了!
您可以尝试再次运行php artisan key:generate
,这应该可以解决问题。