php 如何使用http客户端laravel在Post请求中访问数组[已关闭]

tuwxkamq  于 5个月前  发布在  PHP
关注(0)|答案(1)|浏览(63)

**已关闭。**此问题需要debugging details。目前不接受回答。

编辑问题以包括desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将帮助其他人回答问题。
一年前关闭。
Improve this question
我有这个函数来存储来自刀片表单的数据:

$store = Http::withHeaders([
        'Content-Type' => 'application/json',
        'Authorization' => $token,
    ])->post('http://example.com/api/Order/', [
        'Key' => 1167722,
        'No' => "12",
        'TL' => [
            'Dtl' => "",
            'Code' => "Screw Hex",
            'IsDetail' => true,
            "DTL" => [],
            ]
            ]);

            return $store;

字符串
这就是响应返回的内容:

{"Key":1167722,"No":"12","TL":[]}


TL数组中没有保存任何内容,我尝试用json_encode() Package TL数组,仍然没有运气,我尝试

'TL[Dtl]' => 722,


它也不能储存

sd2nnvve

sd2nnvve1#

解决方案:

'TL' => array ([
        'Dtl' => "",
        'Code' => "Screw Hex",
        'IsDetail' => true,
        "DTL" => [],
        ])
        ]);

字符串
添加array()

相关问题