更新时间:2023-11-26 17:24:22
好吧,如果你只是设置一个cookie,我猜你可以简单一点喜欢:
Well, if you are only setting a cookie I guess you could simply do like:
urlConn.setRequestProperty("Cookie", "user=mary17; domain=airtravelbargains.com; path=/autos");
如果你设置多个cookie,你可能会使用相反,addRequestProperty
方法。
If you're setting more than one cookie than you could probably use the addRequestProperty
method instead.
对于expires属性,请确保使用以下格式:Weekday,DD-Mon-YY HH:MM:SS GMT 。
For the expires attribute make sure to use the format: Weekday, DD-Mon-YY HH:MM:SS GMT.
唯一的合法时区是GMT,日期元素之间的分隔符必须是
破折号。
The only legal time zone is GMT, and the separators between the elements of the date must be dashes.