Bellow是我的wordpress db中的一行SQL的内容:
a:1:{s:5:"codes";a:5:{s:26:"AFFIL2014-I0AILGLNYG3UEAJI";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}s:26:"AFFIL2014-XNAGS9YZMUMHD0PS";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}s:26:"AFFIL2014-WO3X0YJLVHUZCZH6";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:0;s:5:"users";a:1:{i:0;s:13:"testaccount22";}}s:26:"AFFIL2014-PEWHTTOWIZPXQJYU";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}s:26:"AFFIL2014-Y6PTEJT2GLRIVF0J";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}}}
我以前从未见过这样的事情。它看起来像数组,但我不知道如何在我的PHP页面上显示这些内容。
答案 0 :(得分:4)
它被称为 serialize 字符串。您需要使用unserialize函数将其转换回PHP值。
<强> Working Demo 强>
答案 1 :(得分:0)
$serialized = 'a:1:{s:5:"codes";a:5:{s:26:"AFFIL2014-I0AILGLNYG3UEAJI";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}s:26:"AFFIL2014-XNAGS9YZMUMHD0PS";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}s:26:"AFFIL2014-WO3X0YJLVHUZCZH6";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:0;s:5:"users";a:1:{i:0;s:13:"testaccount22";}}s:26:"AFFIL2014-PEWHTTOWIZPXQJYU";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}s:26:"AFFIL2014-Y6PTEJT2GLRIVF0J";a:3:{s:8:"maxcount";i:1;s:9:"leftcount";i:1;s:5:"users";s:0:"";}}}';
$unserialized = unserialize($serialized);
print_r($unserialized);