【已解决】Laravel Class encrypter does not exist No supported encrypter found. The cipher

Laravel 报错加密类找不到。Class encrypter does not exist. No supported encrypter found.

Laravel 5.1 加密类找不到问题

Laravel 项目运行时,报错:

No supported encrypter found. The cipher and / or key length are invalid
Class encrypter does not exist

刚开始以为是,加密拓展没装好,实际上是app密钥没生成、配置到位。

解决否

已解决

方案

点断点, 断到: \Illuminate\Encryption\EncryptionServiceProvider::register

发现读取了配置,配置里面的 key 没初始化。

$ php artisan key:generate

$ php aritsan config:cache

生成的 key 要写入到配置文件里。这配置一般是在 /app/config.php 目录里,实际请按照个人项目来。

这里报错就是因为,随便写了一个字符串,长度不符合key的40长度,导致报错密钥长度不够。

发表评论

邮箱地址不会被公开。 必填项已用*标注