Laravel cookie过期时间无效
我的1台计算机有问题,所以我将我的项目复制到其他计算机(Windows,但此项目是在Linux上创建的),我有问题。我有一些错误。第一个是在标题中 cookie过期时间无效。 我看到当我访问这个控制器时 当我浏览文章时,我能看到 无法建立连接,因为目标计算机主动拒绝连接。(SQL:从Laravel cookie过期时间无效,laravel,cookies,Laravel,Cookies,我的1台计算机有问题,所以我将我的项目复制到其他计算机(Windows,但此项目是在Linux上创建的),我有问题。我有一些错误。第一个是在标题中 cookie过期时间无效。 我看到当我访问这个控制器时 当我浏览文章时,我能看到 无法建立连接,因为目标计算机主动拒绝连接。(SQL:从stats中选择count(*)作为聚合,其中token为空) 我想第二个问题是在MySQL中保存访问者的方法 $token = time() . rand(1, 999); if(!Cookie::get(
stats
中选择count(*)作为聚合,其中token
为空)
我想第二个问题是在MySQL中保存访问者的方法
$token = time() . rand(1, 999);
if(!Cookie::get('visitors')){
Cookie::queue(Cookie::make('visitors', $token), true, 1440);
}
$stats = stats::where('token', Cookie::get('visitors'))->count();
if(Cookie::get('lang')){
$lang = Cookie::get('lang');
} else {
$lang = 'en';
}
if($stats == 0){
stats::create([
'token' => $token,
'lang' => $lang
]);
}
return $next($request);
你能帮我吗?问题是什么?似乎是php 32位问题 编辑:我解决了这个问题,我在Goutte的github repo问题部分发表了评论检查.env文件中的会话生命周期,将该字段留空,这就解决了我的问题
$token = time() . rand(1, 999);
if(!Cookie::get('visitors')){
Cookie::queue(Cookie::make('visitors', $token), true, 1440);
}
$stats = stats::where('token', Cookie::get('visitors'))->count();
if(Cookie::get('lang')){
$lang = Cookie::get('lang');
} else {
$lang = 'en';
}
if($stats == 0){
stats::create([
'token' => $token,
'lang' => $lang
]);
}
return $next($request);