我已经从具有 Serialize 数组和 Implode 和 Json_encode 的表单中保存了数据,如下所示:
序列化
+-------+----------------------------------------+-------------------------------------+----------------------------------------+
| Agent | Customers | Cars | Money |
+-------+----------------------------------------+-------------------------------------+----------------------------------------+
| SMITH | a:2:{i:0;s:4:"Jack";i:1;s:4:"Mike";} | a:2:{i:0;s:3:"BMW";i:1;s:4:"Audi";} | a:2:{i:0;s:5:"1000$";i:1;s:5:"1500$";} |
| ... | ... | ... | ... |
+-------+----------------------------------------+-------------------------------------+----------------------------------------+
放大
+-------+------------+----------+-------------+
| Agent | Customers | Cars | Money |
+-------+------------+----------+-------------+
| SMITH | Jack,Mike | BMW,Audi | 1000$,1500$ |
| ... | ... | ... | ... |
+-------+------------+----------+-------------+
Json_encode
+-------+-----------------+----------------+-------------------+
| Agent | Customers | Cars | Money |
+-------+-----------------+----------------+-------------------+
| SMITH | ["Jack","Mike"] | ["BMW","Audi"] | ["1000$","1500$"] |
| .... | .... | ... | ... |
+-------+-----------------+----------------+-------------------+
我想在管理面板中显示数据,例如波纹管:
代理商 SMITH 将宝马汽车出售给 Jack ,并 1000 $ 和 Audi 汽车出售给< strong>迈克, 1500 $
---------------------
我该如何使用3种方式反序列化,Unimplode和Json_decode ?
答案 0 :(得分:0)
所以我正在考虑您的阵列
<Login />
您的预期输出是
$yourArray = [
'Agent' => 'SMITH',
'Customers' => ["Jack", "Mike"],
'Cars' => ["BMW", "Audi"],
'Money' => ["1000$", "1500$"],
];
因此,首先将其导入您的名字空间
$yourExpectedOutPut = 'Agent SMITH sold BMW car to Jack with 1000$ and Audi car to Mike with 1500$';
如果您有任何疑问或发现任何问题,或者如果答案不是您要查找的内容,请在下面进行评论