2017-06-02 76 views
0

我使用API​​来检查凭证代码是否存在。如果优惠券代码存在,一切都很好,但问题是,当我输入错误代码,然后我得到这个:使用404和来自API的响应

Client error: `GET https://apidev.example.co.uk/api/v1/vouchers/2869512_1-9FDS` resulted in a `404 Not Found` response: 
{ 
"Code": 1000, 
"Description": "Voucher no. is unknown please check and try again or contact Acorne on 0330 111 04 (truncated...) 

我有这样的代码在后端(laravel PHP):

$res = json_decode($res->getBody()->getContents(), true); 
dd($res); 

如何我可以访问代码1000,并删除此错误屏幕?

更新: 当凭证有效和dd($ res)时屏幕; enter image description here

+0

分享的'DD($ RES)的结果;' – Sandeesh

+0

如何处理错误消息? –

+0

当有优惠券时,我使用dd($ res)图像更新问题 –

回答