instantech / session
本包是对 PHP 原生 $_SESSION 的简单封装,用于对象表示
1
2019-11-11 09:38 UTC
Requires
- php: >=7.1.0
This package is auto-updated.
Last update: 2024-09-11 21:25:50 UTC
README
这是一个将 PHP 超全局 $_SESSION 转换为对象表示的基本实现。此包实现了闪存消息接口
要求
- php >=7.1.0
安装
- 安装
$ composer require instantech/session
- 用法
<?php require_once __DIR__.'/vendor/autoload.php'; use Instantech\Session; session_start(); //Set value in the session with key test Session::set("test", 'value'); //Get value matched key test Session::get('test'); //Set a flash message with key success and value IT's success Session::addFlash('success', "IT's succes"); //Read the flash message with key success echo Session::flash('success'); //Clear all information in the session Session::clear(); //Get an array of all value in the session Session::all(); //Check if some key test exist in the session Session::has('test'); //Check if some key success exist in the flash message Session::hasFlash('success'); //Remove the value from the session with key test Session::remove('test');