<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use Illuminate\Support\Facades\Session; class SessionUtil { public static function id() { return Session::getId(); } private static function getDataFromSession($PZCJZ) { goto EmPUA; EmPUA: $PiV1e = Session::getHandler()->read($PZCJZ); goto I5Thn; I5Thn: $OTBPk = @unserialize($PiV1e); goto EgsVA; LZIOx: return $OTBPk; goto Shdlk; EgsVA: if (!is_array($OTBPk)) { $OTBPk = array(); } goto LZIOx; Shdlk: } private static function saveDataToSession($PZCJZ, $OTBPk) { $PiV1e = serialize($OTBPk); Session::getHandler()->write($PZCJZ, $PiV1e); } public static function get($PZCJZ, $rvTrU) { $OTBPk = self::getDataFromSession($PZCJZ); return isset($OTBPk[$rvTrU]) ? $OTBPk[$rvTrU] : null; } public static function put($PZCJZ, $rvTrU, $gwXrh) { goto VfbfD; VfbfD: $OTBPk = self::getDataFromSession($PZCJZ); goto FgDKP; FgDKP: $OTBPk[$rvTrU] = $gwXrh; goto f0keS; f0keS: self::saveDataToSession($PZCJZ, $OTBPk); goto UCEZ8; UCEZ8: } public static function forget($PZCJZ, $rvTrU) { goto CMMJb; hXEvx: unset($OTBPk[$rvTrU]); goto WAAKF; WAAKF: self::saveDataToSession($PZCJZ, $OTBPk); goto LNGrQ; CMMJb: $OTBPk = self::getDataFromSession($PZCJZ); goto hXEvx; LNGrQ: } public static function clear($PZCJZ) { self::saveDataToSession($PZCJZ, array()); } }