Laravel 5 构造函数中 获取 cookie

在构造方法中获取Cookie为加密值,请问如何转化为未加密值

public function __construct()
{
    echo Cookie::get('customer_id');
    // 打印结果
    // eyJpdiI6Im5NZVNkTnpJSlFib3BpXC91VmdHWFJ....
}

public function index()
{
    echo Cookie::get('customer_id');
    // 打印结果
    // 6
}
一只萌萌小番薯
浏览 533回答 2
2回答

LEATH

private $cookies = []; public function __construct() { $this->cookies['customer_id'] = 解码方法(Cookie::get('customer_id')); } public function index() { echo $this->cookies['customer_id']; }
打开App,查看更多内容
随时随地看视频慕课网APP