Domain name and cookie
I accidentally thought of a question: www.g.cn can set the cookie to .g.cn, so can www.com.cn set the cookie to .com.cn?
Test result: No. Because the browser knows that the suffix of www.com.cn is .com.cn instead of .cn, it prohibits setting cookies.
Because the browser has a built-in domain name suffix list. todo: If a new suffix appears in the future and the old browser cannot update the list, will it allow cookies to be set?
extension后缀 | 一级域名 | 二级域名 | |
www.g.cn | .cn | g.cn | *.g.cn |
www.com.cn | .com.cn | www.com.cn | *.www.com.cn |
www.google.com.cn | .com.cn | google.com.cn | *.google.com.cn |
Can www.example.com read the cookie of .example.com?
Yes.
Can www.example.com read the cookie of example.com?
No. todo: Use SSO for www.example.com and example.com to prevent cookies from being brought to static.example.com.
Can example.com read the cookie of www.example.com?
Answer: No.
setcookie('a', 'aa', time() + 1234, '/', 'example.com'); Is the cookie set to .example.com or example.com?
Answer: It’s from .example.com.
If you want to set a cookie for example.com, you need to use setcookie('default', 'default', time() + 1234, '/');.
Cookie setting and reading range:
HTTP请求域名 | 一级域名 | cookie可设置(并可读取)的范围 | cookie不可设置 | cookie不可读取 |
example.com | example.com | example.com,.example.com | www.example.com | www.example.com |
www.example.com | example.com | www.example.com,.www.example.com,.example.com | example.com | example.com |
g.com.cn | g.com.cn | g.com.cn,.g.com.cn | .com.cn | |
www.com.cn | www.com.cn | www.com.cn,.www.com.cn | .com.cn |
Set cookie code:
setcookie('default', 'default', time() + 1234, '/');
setcookie('a', 'aa', time() + 1234, '/', ' example.com');
setcookie('b', 'bb', time() + 1234, '/', '.example.com');
?>
Read cookie code:
var_dump($_COOKIE);
?>
Result screenshot:

主机的域名和主机的ip地址两者之间的关系是:一个IP地址对应多个域名。IP地址用数字化形式来对计算机网络中的主机进行网络标识,域名用字符化形式来对计算机网络中的主机进行网络标识。在Internet中,一个域名之内能够对应一个IP地址,但是一个IP地址可以被多个域名所对应。

在TCP/IP协议套件中,域名系统是提供计算机名称到IP地址映射名称解析服务的协议之一。但是,有时它会出现故障,从而导致错误,例如请求的控制对此服务NETHELPMSG2191无效。DNS客户端和服务器协同工作,为计算机和用户提供计算机名称到IP地址映射名称解析服务。安装Windows后,客户端和服务器版本的操作系统默认启用客户端服务。一旦您在TCP/IP网络配置中指定了服务器的IP地址,DNS客户端就会查询服务器以发现域控制器并将计算机名称解析为IP地址。只有在服务

R55600搭配华硕哪个主板华硕ROGStrixB550-FGaming主板是一个非常出色的选择。它与Ryzen55600X处理器完美兼容,并提供出色的性能和功能。该主板具备可靠的供电系统,可支持超频,并提供丰富的扩展插槽和端口,满足日常使用和游戏需求。ROGStrixB550-FGaming还配备了高品质的音频解决方案、快速的网络连接和可靠的散热设计,确保系统保持高效稳定。此外,该主板还采用了华丽的ROG风格,配备了华丽的RGB照明效果,为您的计算机增添了视觉享受。总而言之,华硕ROGStri

赛扬g4900和i36100哪个好当涉及到赛扬G4900和I36100这两款处理器时,毫无疑问,I36100的性能更胜一筹。赛扬处理器通常被视为低端处理器,主要用于廉价笔记本电脑。而I3处理器则主要用于高端处理器,其性能非常出色。不论是玩游戏还是观看视频,使用I3处理器都不会出现任何卡顿情况。因此,如果你有可能,尽量选择购买英特尔I系列处理器,特别是用于台式机,这样你就能畅享网络世界的乐趣了。赛扬G4900T性能怎么样从性能方面来看,奔腾G4900T在频率方面表现出色,相比之前的版本,CPU性能

申请方法:1、通过工信部网站申请免费域名,等待审核通过后即可获得免费域名;2、通过DNSPod免费申请域名,用户可以在DNSPod上注册账号并申请免费的二级域名;3、选择一个可靠的免费域名服务提供商,通过对比和了解,选择一个可靠的提供商;4、注册账号,点击注册按钮,按照要求填写相关个人信息并创建账号;5、搜索并选择域名即可。

php curl设置cookie的方法:1、创建PHP示例文件;2、通过“curl_setopt”函数设置cURL传输选项;3、在CURL中传递cookie即可。

1、选择一个可用的域名:企业邮箱域名应当与企业的品牌或业务相关。2、查询域名是否已被注册:在选择企业邮箱域名后,需要查询该域名是否已经被其他企业注册。3、选择邮箱服务供应商:企业可通过搜索引擎查找不同的邮箱服务供应商,根据自己的需求选择一个供应商。4、创建账户:注册邮箱服务的过程可能略有不同,但是通常需要填写企业和管理员的基本信息,并创建一个管理员账户。

Discuz域名修改操作指南在使用Discuz论坛系统的过程中,有时候我们需要修改论坛的域名。可能是因为需要更换域名,或者是修复一些域名解析的问题。本文将为大家详细介绍如何在Discuz论坛系统中进行域名修改操作,并给出一些具体的代码示例。1.备份数据在进行任何操作之前,我们都要先备份数据,以防止因操作失误导致数据丢失。在Discuz中,可以使用后台的数据备


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

Notepad++7.3.1
Easy-to-use and free code editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools
