【发布时间】:2021-07-29 05:30:30
【问题描述】:
在我的自定义 wordpress api 端点上出现此错误:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
我该如何调试它?我想看看无法解析的实际 json 字符串。这有可能吗?
这是我的回调函数:
function get_price_callback() {
$resp = get_price('25-05-2021','Depoistum');
$val = htmlspecialchars($resp);
$type = htmlspecialchars( $_GET["type"] );
return rest_ensure_response([$date]);
}
get_price('25-05-2021','Depoistum') // will return 5000
【问题讨论】:
标签: wordpress api wordpress-theming wordpress-rest-api