Php 在laravel 5.4中设置cookie
我试图设置一些cookie变量并重定向到下一个路由Php 在laravel 5.4中设置cookie,php,laravel,cookies,Php,Laravel,Cookies,我试图设置一些cookie变量并重定向到下一个路由 $inputParams = []; $inputParams['show_match_skus'] = $this->request->input('show_match_skus'); $inputParams['show_all'] = $this->request->input('show_all'); $inputParams['prevent_dialog'] = $this
$inputParams = [];
$inputParams['show_match_skus'] = $this->request->input('show_match_skus');
$inputParams['show_all'] = $this->request->input('show_all');
$inputParams['prevent_dialog'] = $this->request->input('prevent_dialog');
$inputParams = array_map(array($this, 'sanitizeInputParams'), $inputParams);
$filterArr = array_filter($inputParams);
if(count($filterArr) > 0) {
if(array_key_exists('show_match_skus', $filterArr)) {
$cookie_sku_match = Cookie::make('show_match_skus', true);
}
if(array_key_exists('show_all', $filterArr)) {
$cookie_all = Cookie::make('show_all', true);
}
if(array_key_exists('prevent_dialog', $filterArr)) {
$cookie_prevent = Cookie::make('prevent_dialog', true);
}
}
//dd(Cookie::get());
//dd(Cookie::get('show_all'));
return redirect()->route('list');
创建cookie后,我需要重定向到列表
路由
但在登录浏览器时,我一个也没有收到
另外,Cookie::get()
仅显示XSRF-TOKEN
和laravel\u会话
但是Cookie::get('show_all')
显示Cookie
我做错了什么?可能是重复的。您需要将其与您的回复一起发送: