How to access the globals $_SESSION and $_COOKIE from a laravel app?

前端 未结 5 1044
悲&欢浪女
悲&欢浪女 2020-12-20 14:36

I am working on a laravel project that needs to work besides a custom php project, because that I need to get access to the pure php globals $_SESSION and $_COOKIE in the la

5条回答
  •  粉色の甜心
    2020-12-20 15:21

    Laravel has its own implementations of $_SESSION and $_COOKIE, so I'm afraid you cannot access them via those superglobals.

    To try to overcome that, what you can do, in your Laravel app, is to transfer data from one to the other by doing something like:

    foreach(Session::all() $key => $value)
    {
        $_SESSION[$key] = $value;
    }
    

提交回复
热议问题