php报错:Cannot use empty array elements in arrays

技术分享 · Fecmall · 于 2年前 发布 · 1453 次阅读

有时候写代码的时候,给一些大数组赋值,有时候会报错:Cannot use empty array elements in arrays

当时也搞的我莫名其妙的,后来排查发现问题,譬如:

$arr = [
	'platformCode' => 'Fecmall',   // 订单平台代码
            'remarks' => $orderInfo['order_remark'],,   // 订单备注,只能新增
            'saleRecordNum' => $orderInfo['increment_id'],   // 订单号
            'sellerAccountCode' => '',   // 卖家账号代码
            'shippingMethodId' => $orderInfo['shipping_method'],   // 渠道ID
            'taxIncome' => '',   // 买家支付的税金
            'taxIncomeCurrency' => '',   // 买家支付的税金币种
            'totalPrice' => $orderInfo['grand_total'],   // 订单总额
            'totalPriceCurrency' => $orderInfo['order_currency_code'],  // 订单总额币种
            'transactions' => $orderItemArr,,
            'warehouseId' => '',   // 仓库ID

];

解决: 'transactions' => $orderItemArr,,, 把,, 改成 , 就可以了,因此,大数组赋值的时候,一定要注意,不要有空的逗号

共收到 0 条回复
没有找到数据。
添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics