ichynul/tp-cookie

webman extension

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/ichynul/tp-cookie

1.0.0 2025-12-02 11:22 UTC

This package is auto-updated.

Last update: 2025-12-02 11:57:47 UTC


README

使用

用法和tp的类似

use tpcookie\Cookie;

Cookie::set('name', 'value', 3600);//设置cookie,3600秒后过期
Cookie::get('name');//获取cookie
Cookie::delete('name');//删除cookie
Cookie::has('name');//判断cookie是否存在

$option = ['expire'=>3600, 'path'=>'/', 'domain'=>'', 'secure'=>false, 'httponly'=>false, 'samesite'=>''];
Cookie::set('name', 'value', $option);//option为数组

助手函数

//`cookie()` 或 `tp_cookie()`

function tp_cookie(string $name, $value = '', $option = null){
    //
}
tp_cookie('name', 'value', 3600);//设置cookie,3600秒后过期
tp_cookie('name');//获取cookie
tp_cookie('name', null);//删除cookie
tp_cookie('?name');//判断cookie是否存在

tp_cookie('name', 'value', $option);//option为数组