📜  laravel 获取 cookie 值 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:25.193000             🧑  作者: Mango

代码示例2
// This is a little messy, but works with update in 2020
// see security note: https://blog.laravel.com/laravel-cookie-security-releases

use Illuminate\Support\Facades\Crypt;

$hmac_prefixed = Crypt::decryptString(request()->cookie('cookie_name')) // result "a86aa854d5e61e2873acd30373b6725e36fba671|cookie_value"
$cookie_value = explode("|",$hmac_prefixed)[1];