123
}
$name = $config['prefix'] . $name;
// 设置cookie
if (is_array($value)) {
array_walk_recursive($value, 'self::jsonFormatProtect', 'encode');
$value = 'think:' . json_encode($value);
}
$expire = !empty($config['expire']) ? $_SERVER['REQUEST_TIME'] + intval($config['expire']) : 0;
if ($config['setcookie']) {
setcookie($name, $value, $expire, $config['path'], $config['domain'], $config['secure'], $config['httponly']);
}
$_COOKIE[$name] = $value;
}
/**
* 永久保存Cookie数据
* @param string $name cookie名称
* @param mixed $value cookie值
* @param mixed $option 可选参数 可能会是 null|integer|string
name | think_var |
value | en-us |
option | { "expire": 3600 } |
config | { "prefix": "", "expire": 3600, "path": "\/", "domain": "", "secure": false, "httponly": "", "setcookie": true } |
expire | 1731123248 |
Hm_lvt_c039452ebcf0055ec7f3a2444039dd1b | 1731037992 |
USER | www |
HOME | /home/www |
HTTP_COOKIE | Hm_lvt_c039452ebcf0055ec7f3a2444039dd1b=1731037992 |
HTTP_PRIORITY | u=0, i |
HTTP_ACCEPT_LANGUAGE | en-US,en;q=0.9 |
HTTP_ACCEPT_ENCODING | gzip, deflate, br, zstd |
HTTP_SEC_FETCH_DEST | document |
HTTP_SEC_FETCH_USER | ?1 |
HTTP_SEC_FETCH_MODE | navigate |
HTTP_SEC_FETCH_SITE | none |
HTTP_ACCEPT | text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 |
HTTP_USER_AGENT | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0 |
HTTP_UPGRADE_INSECURE_REQUESTS | 1 |
HTTP_SEC_CH_UA_PLATFORM | "Windows" |
HTTP_SEC_CH_UA_MOBILE | ?0 |
HTTP_SEC_CH_UA | "Chromium";v="130", "Microsoft Edge";v="130", "Not?A_Brand";v="99" |
HTTP_HOST | uzhen.com |
PATH_INFO | |
REDIRECT_STATUS | 200 |
SERVER_NAME | www.uzhen.com |
SERVER_PORT | 443 |
SERVER_ADDR | 172.30.156.99 |
REMOTE_PORT | 8050 |
REMOTE_ADDR | 118.68.1.50 |
SERVER_SOFTWARE | nginx/1.24.0 |
GATEWAY_INTERFACE | CGI/1.1 |
HTTPS | on |
REQUEST_SCHEME | https |
SERVER_PROTOCOL | HTTP/2.0 |
DOCUMENT_ROOT | /www/wwwroot/youzhen/app_web/public |
DOCUMENT_URI | /index.php |
REQUEST_URI | / |
SCRIPT_NAME | /index.php |
CONTENT_LENGTH | |
CONTENT_TYPE | |
REQUEST_METHOD | GET |
QUERY_STRING | |
SCRIPT_FILENAME | /www/wwwroot/youzhen/app_web/public/index.php |
FCGI_ROLE | RESPONDER |
PHP_SELF | /index.php |
REQUEST_TIME_FLOAT | 1731119648.0809 |
REQUEST_TIME | 1731119648 |
APP_PATH | /www/wwwroot/youzhen/app_web/public/../application/ |
THINK_VERSION | 5.0.5 |
THINK_START_TIME | 1731119648.0812 |
THINK_START_MEM | 421960 |
EXT | .php |
DS | / |
THINK_PATH | /www/wwwroot/youzhen/app_web/thinkphp/ |
LIB_PATH | /www/wwwroot/youzhen/app_web/thinkphp/library/ |
CORE_PATH | /www/wwwroot/youzhen/app_web/thinkphp/library/think/ |
TRAIT_PATH | /www/wwwroot/youzhen/app_web/thinkphp/library/traits/ |
ROOT_PATH | /www/wwwroot/youzhen/app_web/ |
EXTEND_PATH | /www/wwwroot/youzhen/app_web/extend/ |
VENDOR_PATH | /www/wwwroot/youzhen/app_web/vendor/ |
RUNTIME_PATH | /www/wwwroot/youzhen/app_web/runtime/ |
LOG_PATH | /www/wwwroot/youzhen/app_web/runtime/log/ |
CACHE_PATH | /www/wwwroot/youzhen/app_web/runtime/cache/ |
TEMP_PATH | /www/wwwroot/youzhen/app_web/runtime/temp/ |
CONF_PATH | /www/wwwroot/youzhen/app_web/public/../application/ |
CONF_EXT | .php |
ENV_PREFIX | PHP_ |
IS_CLI | false |
IS_WIN | false |