Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up Cookie

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to set cookies," interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's take you to learn "How to set cookies"!

Cookie settings

Cookie settings are very simple, cookies are sent separately in the http header. The following example sets name and expires in the cookie:

#!/ usr/bin/python3

print ('Set-Cookie: name="Rookie Tutorial";expires=Wed, 28 Aug 2016 18:30:00 GMT')

print ('Content-Type: text/html')

print ()

print ("""

Rookie tutorial (runoob.com)

Cookie set OK!

""")

Save the above code to cookie_set.py and modify cookie_set.py permissions:

chmod 755 cookie_set.py

The above example uses Set-Cookie header information to set Cookie information, and other attributes of cookies are set in the optional options, such as expiration time Expires, domain name, and path. This information is set before "Content-type:text/html".

At this point, I believe that everyone has a deeper understanding of "how to set cookies," so you may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report