Wolfram 语言

系统级功能

持久性 cookie

缺省情况下,cookie 不能存在于全部进程中. 可以把有确定过期日期的 cookie 保存在由 $CookieStore 确定的文件中. 设置为 Automatic 时,系统会自动选择该文件.

开始时,$CookieStore 被设为 None.

In[1]:=
Click for copyable input
$CookieStore
Out[1]=

改成 Automatic.

In[2]:=
Click for copyable input
$CookieStore = Automatic
Out[2]=

该文件将包含持久性 cookie.

In[3]:=
Click for copyable input
$CookieStore
Out[3]=

cookie 以未经处理的形式保存. 下面列表中的每一行对应于一个 cookie. 每一行要么包含 TRUE,要么包含 FALSE,或者两者皆有.

In[4]:=
Click for copyable input
FindList[$CookieStore, {"TRUE", "FALSE"}]
Out[4]=

访问一个网站.

In[5]:=
Click for copyable input
URLRead["amazon.com"]
Out[5]=

现在,cookie 保存文件中含有更多的 cookie.

In[6]:=
Click for copyable input
FindList[$CookieStore, {"TRUE", "FALSE"}]
Out[6]=

相关范例

de en es fr ja ko pt-br ru