gpt4 book ai didi

jquery cookie 将值设置为 bool 值 true

转载 作者:行者123 更新时间:2023-12-03 22:24:32 24 4
gpt4 key购买 nike

我正在使用这个jquery.cookie插件,我需要将值设置为 TRUE 或 NULL/FALSE。

我试图这样做: $.cookie('ff', true, { expires: 30, path: '/' }); 但它将值设置为字符串并且不是 bool 值。

有什么办法可以解决这个问题吗?

最佳答案

Cookie 仅是字符串值。如gdoron commented ,如果你想将值视为 bool 值,则需要在读回 cookie 值时将其解析回 bool 值。

既然您评论说您正在使用 PHP 读取 cookie 值,请参阅 Parsing a string into a boolean value in PHP .

关于jquery cookie 将值设置为 bool 值 true,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9752442/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com