我正在使用laravel默认的Auth。当我登录我的网站时,一切都很棒。当我尝试刷新或转到另一个页面(仍使用Auth中间件)时,我的会话已过期,我已直接注销,我必须再次登录。我该如何解决这个问题,以便在刷新页面或浏览另一个页面时保持登录状态?
答案 0 :(得分:1)
检查sesssion配置文件:
ImageView
如果你有
<?php
$query_getFeatureCat = sprintf("SELECT `Ref`, Cat_Ref, dist FROM newtable WHERE `Ref` = %s", GetSQLValueString($colname_getFeatureCat, "text"));
$getFeatureCat = mysql_query($query_getFeatureCat, $db) or die(mysql_error());
$row_getFeatureCat = mysql_fetch_assoc($getFeatureCat);
while ($row_selectCategories = mysql_fetch_assoc($selectCategories)) {
if ($row_getFeatureCat) {
if (in_array($row_selectCategories['Cat_Ref'], $row_getFeatureCat)) {
$checked = 'checked';
} ?>
}
<input type="checkbox" name="Cat_Ref_Array[]" value="<?php echo $row_selectCategories['Cat_Ref']; ?>" <?php echo $checked; ?>/>
<label for="Category"><?php echo $row_selectCategories['Category']; ?></label>
<?php } ?>
检查会话文件夹的权限,默认为&#39; storage / framework / sessions&#39;:
config/session.php
答案 1 :(得分:1)
值得改变(app / session.php):
'cookie' => 'laravel_session'
与您的应用/网站相关的内容,因为每次编译缓存时都会重置
答案 2 :(得分:0)
您还可以尝试在config / session.php
中设置更高的生命周期/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => 120,
'expire_on_close' => false,
如果将expire_on_clone设置为true,请注意,当浏览器关闭时,会话将过期