如何使用作为对象且序列化的 SESSION 变量?
我正在尝试为序列化对象变量中的项目分配一个值。我该怎么办?我在下面粘贴了 SESSION 数组作为键/值的摘录。
selected_region=18
delivery_region=18
cart=O:9:"cart":40:{s:16:"delivery_country";s:2:"US";s:16:"selected_country";s:2:"US";s:15:"delivery_region";s:2:"18";s:15:"selected_region";s:2:"18";s:24:"selected_shipping_method";s:9:"tablerate";s:24:"selected_shipping_option";s:10:"Table Rate";s:24:"selected_shipping_amount";d:8;s:6:"coupon";N;s:14:"tax_percentage";s:1:"0";s:9:"unique_id";s:40:"cdaa5a32e39b5470f21f43dd847e8cb1eb3d9327";s:6:"errors";a:0:{}s:9:"total_tax";i:0;s:13:"base_shipping";N;s:19:"total_item_shipping";N;s:14:"total_shipping";N;s:8:"subtotal";i:0;s:11:"total_price";N;s:13:"uses_shipping";N;s:13:"is_incomplete";b:1;s:10:"cart_items";a:0:{}s:9:"cart_item";O:14:"cart_item":34:
我试图将“selected_shipping_amount”分配给另一个值。我怎样才能触及并分配它?
谢谢...
I am trying to assign a value to an item within the serialized object variable. How do I go about that? I have pasted below an excerpt of what the SESSION array looks like as key/value.
selected_region=18
delivery_region=18
cart=O:9:"cart":40:{s:16:"delivery_country";s:2:"US";s:16:"selected_country";s:2:"US";s:15:"delivery_region";s:2:"18";s:15:"selected_region";s:2:"18";s:24:"selected_shipping_method";s:9:"tablerate";s:24:"selected_shipping_option";s:10:"Table Rate";s:24:"selected_shipping_amount";d:8;s:6:"coupon";N;s:14:"tax_percentage";s:1:"0";s:9:"unique_id";s:40:"cdaa5a32e39b5470f21f43dd847e8cb1eb3d9327";s:6:"errors";a:0:{}s:9:"total_tax";i:0;s:13:"base_shipping";N;s:19:"total_item_shipping";N;s:14:"total_shipping";N;s:8:"subtotal";i:0;s:11:"total_price";N;s:13:"uses_shipping";N;s:13:"is_incomplete";b:1;s:10:"cart_items";a:0:{}s:9:"cart_item";O:14:"cart_item":34:
I am trying to assign say "selected_shipping_amount" to another value. How can I reach into that and assign it?
Thanks...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你唯一的选择是反序列化它,分配值,然后再次序列化它。
I think your only option is to unserialize it, assign the value and then serialize it again.