【发布时间】: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。
【问题讨论】:
-
对于 AES-128-CBC,您的密钥需要是 16 个字符的随机数据。你是 32 岁。切换到 AES-256-CBC,你可能会解决这个问题。此外,请确保已安装 OpenSSL 扩展。
-
我建议查看此页面右侧的Linked 和Related 问题。里面有一些有用的建议。
-
@ScottArciszewski 感谢您的支持,但问题仍然存在,我已使用此密钥 "MzKfrO9x6D32y6YJE9dX6RtDRIg5PnGsGVab9AIefpU=" 切换到 AES-256-CBC 但错误仍然存在。
标签: php encryption laravel-5