PHP 设置 Cookie 的函数 Setcookie

Setcookie 函数

bool setcookie ( string $name [, string $value = "" [, int $expire = 0 [, string $path = "" [, string $domain = "" [, bool $secure = false [, bool $httponly = false ]]]]]] )
参数 注解
name Cookie 名称。
value Cookie 值。比如 name 是 'cookiename', 可通过 $_COOKIE['cookiename'] 获取它的值。
expire 过期时间,Unix 时间戳。
path Cookie 有效路径。设置成 '/' 时,对 domain 整个域名有效。如果设置成 '/user/',仅对 「domain 参数值/user/」 目录及其子目录有效。默认值是本函数所属访问地址的当前目录
domain Cookie 的生效域名。生效的域名为设置的域名以及它的全部子域。如果设置的是,生效的就是 和它的所有子域。如果设置的是,生效的就是 和它的所有子域。旧版浏览器仍然在使用废弃的 RFC 2109, 需要一个前置的点(.) 来匹配所有子域名。
secure 是否仅仅通过 HTTPS 连接传输。默认值 false。
httponly 是否仅仅通过 HTTP 协议访问,设置成 false 也就是不允许 JavaScript 这样的脚本语言访问。 默认值 false。

RFC 6265 对 setcookie() 每个参数的参考标准

以上是对 PHP 官方文档 setcookie 函数 内容,做了一些修改。

Setcookie Domain 代码示例

代码示例中的「可操作」代表可以使用 $_COOKIE 获得,以及可以使用 setcookie 修改(删除也是修改,把 expire 参数设置为小于当前时间的时间戳就是相当于删除了,例如 time()-86400

//、* 可操作
setcookie('blog_url', '后三排', time()+86400, '/', '');

//、* 可操作
setcookie('blog_url', '后三排', time()+86400, '/', '');
本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可。

A dog’s face can very easily give away their guilt. It doesn’t help when they are standing directly in front of the mess they just created. But admit it, you stay mad for about 10 seconds and then you have to laugh at the situation standing before you. React Element 87

In the middle of the whirwind relationship that’s threatening both his finances and his heart, Nick found his way to a LA Koreatown bar to express his emotions. A short clip shows the actor putting his own spin on Prince’s “Purple Rain”... to say the least. Yeezy nike factory outlet store online retro jordan 33

Oh my goodness! an amazing article dude. Thank you Nevertheless I'm experiencing concern with ur rss . Don抰 know why Unable to subscribe to it. Is there anybody getting similar rss drawback? Anyone who knows kindly respond. Thnkx

An attention-grabbing discussion is value comment. I feel that you should write extra on this topic, it won't be a taboo subject however typically people are not sufficient to speak on such topics. To the next. Cheers

This site is really a stroll-through for the entire information you wanted about this and didn抰 know who to ask. Glimpse here, and you抣l definitely discover it.

You made some decent points there. I seemed on the web for the problem and located most individuals will go along with together with your website.

Peut On Avoir Du Viagra Sans Ordonnance Swollen Glands And Amoxicillin <a href=>vardenafil india bay</a> Baclofene Cochin Viagra Marseille

This web page is really a walk-via for all the data you needed about this and didn抰 know who to ask. Glimpse right here, and also you抣l definitely uncover it.

Canadian Pharmasuticals Viagra <a href=>cheapest cialis 20mg</a> Cialis 5 Mg Comprar Cialis Meglio Del Viagra

I would like to show my love for your generosity supporting people that require help on the subject matter. Your real dedication to passing the message all over ended up being extremely functional and have specifically allowed most people just like me to attain their goals. Your own warm and helpful advice entails so much to me and far more to my mates. Regards; from everyone of us. [url=]yeezy boost 350[/url]

Isotretinoin 10mg Precio De Viagra En Espana <a href=>order cialis online</a> Cialis Online Cs Was Kostet Viagra In Griechenland

I wish to voice my appreciation for your generosity giving support to people who require help with that matter. Your real commitment to getting the message across appears to be particularly powerful and have regularly permitted most people much like me to achieve their dreams. Your own informative publication means so much to me and a whole lot more to my mates. Best wishes; from everyone of us. node%3F

Thank you so much for providing individuals with an extraordinarily remarkable opportunity to read articles and blog posts from here. It's usually very lovely and also jam-packed with amusement for me personally and my office fellow workers to search your site on the least 3 times in 7 days to read the latest items you have got. Of course, I'm certainly amazed with your very good information you give. Some 2 ideas in this post are undoubtedly the very best I've ever had. 457F3C47-96BA-479F-926C-9F292B9DB1DA