获取请求的时区:

$timezone = isset($_COOKIE['timezone']) ? $_COOKIE['timezone'] : 'UTC';

curl时设置该时区:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Time-Zone: ' . $timezone));
$response = curl_exec($ch);
curl_close($ch);
PHP获取请求的时区并curl时设置该时区代码示例

原文地址: https://www.cveoy.top/t/topic/1VL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录