我有这样的路线
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:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php:29
Stack trace:
#0 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(733): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}(Object(Illuminate\Foundation\Application), Array)
#1 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(626): Illuminate\Container\Container->build(Object(Closure), Array)
#2 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(674): Illuminate\Container\Container->make('encrypter', Array)
#3 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(837): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#4 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(800): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#5 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(771): Illuminate\Container\Container->getDependencies(Array, Array)
#6 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(626): Illuminate\Container\Container->build('IAServer\\Http\\M...', Array)
#7 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(674): Illuminate\Container\Container->make('IAServer\\Http\\M...', Array)
#8 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(143): Illuminate\Foundation\Application->make('IAServer\\Http\\M...')
#9 C:\wamp\www\iaserver\public\index.php(58): Illuminate\Foundation\Http\Kernel->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response))
#10 {main}
.env文件是正确的,我重新运行php artisan key:generate
APP_ENV=local
APP_DEBUG=true
APP_KEY=UC5Fsvi8JsGG4U72k04rS3o5csiINDYB
但是只有当路由快速加载了不同的id时,错误仍然会出现。
为什么?
我解决了,有时候laravel没有在.ENV中读取APP_KEY。并返回一个值" SomeRandomString" (默认在config / app.php中定义),并且错误"密钥长度无效",因此解决方案是将APP_KEY的值复制到值' key&#39 ;在config / app.php中,这就是全部!我解决了!
答案 0 :(得分:2)
您可以尝试再次运行php artisan key:generate
,这可以解决问题。