【发布时间】:2019-05-26 23:55:01
【问题描述】:
我想使用 WP All Export 将 woocommerce 数组“redq_day_ranges_cost”导出为 XML 格式。如果我尝试反序列化数组,我会遇到这个 PHP 错误:unserialize(): Error at offset...
我尝试了这里提到的东西:How to repair a serialized string which has been corrupted by an incorrect byte count length?
问题是,由于该错误,WP All Export 已经无法保存导出模板,所以我在这里感到有些失落。
这是要导出的数据:
a:7:{
i:0;a:4
{s:8:"min_days";s:1:"1";s:8:"max_days";s:1:"1";s:10:"range_cost";s:2:"340";s:15:"cost_applicable";s:5:"fixed";}
i:1;a:4:
{s:8:"min_days";s:1:"2";s:8:"max_days";s:1:"2";s:10:"range_cost";s:2:"450";s:15:"cost_applicable";s:5:"fixed";}
i:2;a:4:
{s:8:"min_days";s:1:"3";s:8:"max_days";s:1:"3";s:10:"range_cost";s:2:"570";s:15:"cost_applicable";s:5:"fixed";}}
计划是将其导出为类似的东西
<min_days>1</min_days>
<max_days>1</max_days>
<range_cost>340</range_cost>
<cost_applicable>fixed</cost_applicable>
到目前为止,如果我在函数编辑器中调用反序列化,结果就是命名错误。如果我在 XML 编辑器中内联调用它,则会产生 3 行
<redq_day_ranges_cost>Array</redq_day_ranges_cost>
【问题讨论】:
标签: php arrays serialization