【发布时间】:2021-07-23 15:25:10
【问题描述】:
Array ( [0] => Array ( [counterPickTime] => January [courierRetTime] => [Courier] => S [CourierRet] =>
[counterPick] => [orderType] => Merchant [destination] => interDistrict [creation_date] => 2021-04-19
22:28:44 [PreRet] => [PreRetTime] => [reason] => [reasonEnglish] => [PickDropBy] => tuntun45 )
我想将所有数组名称分配为带有它们的值的 php 字符串。示例:[counterPickTime] => January 我想要 php 中的 $counterPickTime= "January";!我该怎么做?
尝试过 -
implode(',', $result)
json_encode($result)
但是对于它的复杂模式没有任何效果,该怎么做? :(
【问题讨论】:
-
请问您为什么认为需要单独的变量?直接从数组中访问值有什么问题?如果您想将其编码为 JSON,则只需提供整个数组。在将其转换为 JSON 之前将其转换为字符串是没有意义的。
-
您是否要重新创建php.net/manual/en/function.extract.php ...?