2
我需要这种类型的PHP JSON响应的PHP打印阵列内JSON
{
"errors": [
{
"message": "Something went wrong!"
}
]
}
其中的“错误”是一个数组,而“信息”被编码在JSON
如果我编码它像这
json_encode (['errors' => ['message' => 'Unauthenticated.']])
它打印像
{
"errors": {
"message": "Unauthenticated."
}
}
但我想像上面那样,对此有任何适当的解决方案?