【问题标题】:Session in Laravel 5.4.3 doesn't worksLaravel 5.4.3 中的会话不起作用
【发布时间】:2017-09-12 09:55:19
【问题描述】:

我在 laravel 中的会话有问题, 在 localhost 中工作正常,但在共享主机 (webhostingworld) 中不起作用 相同的代码。 这是 session.php 中的代码

<?php
return [
    'driver' => env('SESSION_DRIVER', 'file'),
    'lifetime' => 120,
    'expire_on_close' => false,
    'encrypt' => false,   
    'files' => storage_path('framework/sessions'),
    'connection' => null,
    'table' => 'sessions',
    'store' => null,   
    'lottery' => [2, 100],
    'cookie' => 'laravel_session',
    'path' => '/',  
    'domain' => '',
    'secure' => env('SESSION_SECURE_COOKIE', false),
    'http_only' => true,

];

这是web.php中的代码

Route::get('/put',function(){
    Session::put('test','testing');
    return Session::get('test'); //here returning testing
});
Route::get('/get',function(){
    return Session::get('test'); //but here return empty result
});

服务器 PHP 版本 5.6.31,无法通过 SSH 访问共享主机

【问题讨论】:

  • 检查storage的权限,如果你使用的是linux:chmod -R a+rw storage/
  • 存储权限 777 @Troyer
  • 你的存储目录有文件吗?
  • 有app、framework、logs文件夹@DanMiller
  • 对不起。我的意思是在会话存储路径中。 framework/sessions

标签: php laravel session


【解决方案1】:

发现问题,我已经创建了 settings.php 文件,用于上传图像特定文件夹,从托管会话中删除该文件后工作

【讨论】:

    猜你喜欢
    • 2018-12-14
    • 1970-01-01
    • 2015-10-13
    • 2015-06-03
    • 2017-02-27
    • 2018-07-02
    • 2014-09-14
    • 2018-01-22
    • 1970-01-01
    相关资源
    最近更新 更多