【问题标题】:No supported encrypter found issue未找到支持的加密器问题
【发布时间】:2016-09-27 02:40:34
【问题描述】:

当我在我的 laravel (5.2) 上发布我的表单时,当它必须将一些值返回到前一页时,我会得到这个。

我的控制器

class WsRegisterController extends Controller{

public function register()
{
    $wsregistration = Input::all();
    $wsUserName = Input::get('name');
    $wsUserEmail = Input::get('email');
    $wsUserPassword = Input::get('password');

    /* Check if user is a bot */

    $wsrules = [
    // 'g-recaptcha-response' => 'required|recaptcha', capthcha
    'name'   => 'required|min:2|max:32',
    'email'  => 'required|email',
    'password' => 'required|alpha_num|min:8'
    ];

    $wsvalidator = Validator::make($wsregistration, $wsrules);

    if ($wsvalidator->passes()) {

        /* Check if the email address exits */

        $wsUser_count = User::where('email', '=', $wsUserEmail)->count();

        // return $wsUser_count; exit;

        if ( $wsUser_count > 1 ) {

            return Redirect::to('/test')->with(array('error_msg' => 'This email address exist, please use another email address.'));

        }
     }
   }
  }

所以我尝试用这个 link 对其进行堆栈溢出,但它仍然无法正常工作

CONFIG/APP.PHP 文件

/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/

'key' => env('o/tPhyhKmuLoJMWXZeV8b10OFoCT62z6WKuC3HO5Jbw='),// env('9TSL9BsEjZyoM9BjX9du0XaLnCDi4m4Z'),

'cipher' => 'AES-128-CBC',//'AES-256-CBC',

.ENV 文件

APP_KEY=base64:o/tPhyhKmuLoJMWXZeV8b10OFoCT62z6WKuC3HO5Jbw=
APP_URL=http://localhost

我什至做了这个工匠命令来生成新密钥php artisan key:generate 请问我做错了什么@everyone。

No supported encrypter found error snapshot

【问题讨论】:

  • 对于 AES-128-CBC,您的密钥需要是 16 个字符的随机数据。你是 32 岁。切换到 AES-256-CBC,你可能会解决这个问题。此外,请确保已安装 OpenSSL 扩展。
  • 我建议查看此页面右侧的LinkedRelated 问题。里面有一些有用的建议。
  • @ScottArciszewski 感谢您的支持,但问题仍然存在,我已使用此密钥 "MzKfrO9x6D32y6YJE9dX6RtDRIg5PnGsGVab9AIefpU=" 切换到 AES-256-CBC 但错误仍然存​​在。

标签: php encryption laravel-5


【解决方案1】:

感谢@everyone 的支持,但我已经解决了。

'key' => '9TSL9BsEjZyoM9BjX9du0XaLnCDi4m4Z',// env('9TSL9BsEjZyoM9BjX9du0XaLnCDi4m4Z'), 'cipher' => 'AES-256-CBC',

php 工匠配置:缓存

施了魔法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-20
    • 1970-01-01
    • 2016-06-17
    • 1970-01-01
    • 2018-06-18
    • 1970-01-01
    • 2015-10-09
    • 2016-06-11
    相关资源
    最近更新 更多