我正在尝试将 RESTful Exception Error 对象转换为字符串以保存并发送电子邮件。
我得到错误json_encode(): type is unsupported, encoded as null
。从谷歌搜索,似乎 json_encode 不应该有问题,但它不适用于资源变量。
这是对象的样子:
RESTful\Exceptions\HTTPError Object
(
[response] => Httpful\Response Object
(
[body] => stdClass Object
(
[status] => Bad Request
[category_code] => request
[additional] =>
[status_code] => 400
[extras] => stdClass Object
(
[card_uri] => "None" must be a string URI
)
[category_type] => request
[_uris] => stdClass Object
(
)
[request_id] => XXX
[description] => Invalid field [card_uri] - "None" must be a string URI Your request id is XXX.
)
[raw_body] ⇒ {
"status": "Bad Request",
"category_code": "request",
"additional": null,
"status_code": 400,
"extras": {
"card_uri": "\"None\" must be a string URI"
},
"category_type": "request",
"_uris": {},
"request_id": "XXX",
"description": "Invalid field [card_uri] - \"None\" must be a string URI Your request id is XXX."
}