xoxo419
V2EX  ›  问与答

Laravel-5.5-session 怎么读不出值?

  •  
  •   xoxo419 · Jan 30, 2018 · 1526 views
    This topic created in 3059 days ago, the information mentioned may be changed or developed.

    我使用的是 file 存储方式. 用的 session 全局辅助函数, 在 a 方法保存 然后在 b 方法中读取就读不到了. 我查看了 storage/framework/sessions 文件夹里也有文件产生, 也可以看到值.

    public function a()
    {
    	session(['aaa' => 'valueaaa']);
    	session()->save();
    }
    
    public function b()
    {
    	$value = session('aaa');
    	var_dump($value);#打印出来是 null 
    }
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3207 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:43 · PVG 19:43 · LAX 04:43 · JFK 07:43
    ♥ Do have faith in what you're doing.