**已关闭。**此问题需要debugging details。它目前不接受回答。
编辑问题以包括desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将有助于其他人回答这个问题。
昨天关门了。
Improve this question的
如何返回以下响应?
成功后应返回:
{ status : "ok", data :
[ { franchisor_no : <franchisor number>
, franchisor_status : uncollected | active | delivered | returned | exception
, events_list :
[ { date: <date>, status : uncollected | active | delivered | returned | exception
, description: <optional description>
, code: <optional code, may map to the defined franchisor codes>
, location: <optional location, such as city or hub>.
... raw_event: <the original event as received from the franchisor API. mandatory
... } ] } .... ] }
字符串
我正在使用这段代码,但没有向我的服务器发送任何响应。请让我知道,如果有任何错误,在这个代码?
<?php
$data = json_decode(file_get_contents("php://input"));
echo json_encode = [
"status" => "ok",
"data" => [
[
"franchisor_no" => "1210110080",
"franchisor_status" => "exception",
"events_list" => [
[
"date" => "30-07-2023",
"status" => "exception",
"description" => "optional",
"code" => "optional",
"location" => "optional",
"raw_event" => "mandatory"
],
],
],
],
];
型
1条答案
按热度按时间z4bn682m1#
应该是的
字符串
您没有调用json_encode()。你只是在它前面加上一个等号