Home  >  Q&A  >  body text

How does laravel response return json data and status code at the same time?

Return a json prompt

['code' => 'Verification code error! ']

Then return a status code with a response header of 422

PHP中文网PHP中文网2713 days ago543

reply all(1)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 16:50:26

    return response()->json(['code' => '验证码错误!'],422)

    reply
    0
  • Cancelreply