gpt4 book ai didi

php - 将 JSON 对象附加到 URL 末尾

转载 作者:行者123 更新时间:2023-12-01 02:24:52 25 4
gpt4 key购买 nike

我有这段代码:

       //execute post (the result will be something like {"result":1,"error":"","id":"4da77536a2338","lockcode":"4af15b3725eb5cf3641d96f6c7a3b71d"})       $result = curl_exec($ch);       $response = json_decode($result);       //close connection          curl_close($ch);       $imageHref = 'http://my.site.com/render?id=' . $response['id'];

但由于某种原因,我无法将 id 附加到 URL 末尾。有什么想法吗?

最佳答案

这是因为 json 解码不会返回一个数组,而是一个对象。相反:

$imageHref = 'http://my.site.com/render?id=' . $response->id;

关于php - 将 JSON 对象附加到 URL 末尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5683010/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com