overclokk/cookie
最新稳定版本:2.0.0-alpha.4
Composer 安装命令:
composer require overclokk/cookie
包简介
A simple and light cookie manager class
README 文档
README
A simple and light php class for Cookie!
Get and set cookies in PHP with ease.
PHP >= 5.3
Installation
Install this package through Composer:
composer require overclokk/cookie
PHP Implementation
Autoload the vendor classes:
require_once 'vendor/autoload.php'; // Path may vary
And then use the Cookie implementation:
$cookie = new \Overclokk\Cookie\Cookie();
or
$cookie = new \Overclokk\Cookie\Cookie( $_COOKIE );
Usage
Get a cookie
This will return null if the cookie doesn't exist or is expired.
$cookie_value = $cookie->get( 'cookie_name' );
Store a cookie for a limited time
If you don't specify $minutes, a default of 0 will be used.
$minutes = 120 * 60; $cookie->set( 'cookie_name', 'cookie_value', $minutes );
Set a cookie forever
$cookie->forever( 'cookie_name', 'cookie_value' );
Delete a cookie
If the cookie doesn't exist, nothing will happen...
$cookie->delete('cookie_name');
统计信息
- 总下载量: 2.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2017-02-03