php版微信開發(fā)之接收消息,自動判斷及回復(fù)相應(yīng)消息的方法
663
2024-01-25
如下所示:
axios.get("/check_mobile_and_sent_code",{withCredentials:true,params:{mobile:formInline.mobile}}).then(res=>{ console.log(res); //if(res.result==true){ if (!this.timer) { this.count = this.TIME_COUNT; this.show = false; this.timer = setInterval(() => { if (this.count > 0 && this.count <= this.TIME_COUNT) { this.count--; } else { this.show = true; clearInterval(this.timer); this.timer = null; } }, 1000) } //} }).catch(error=>{ console.log(error.response.data); console.log(error.response.status); console.log(error.response.headers); console.log('Error', error.message); console.log(error.config); })
使用場景:
當(dāng)后端判斷驗證的手機號已存在的時候會返回400,這時需要跳到error條件中,得到后臺400的返回數(shù)據(jù)如上。
以下是error.response返回值:
這里如果直接輸出error,等于error.message
附狀態(tài)碼為200的返回值:
以上這篇前端獲取http狀態(tài)碼400的返回值實例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持綠夏網(wǎng)。
#免責(zé)聲明#
本站[綠夏技術(shù)導(dǎo)航]提供的一切軟件、教程和內(nèi)容信息僅限用于學(xué)習(xí)和研究目的;不得將上述內(nèi)容用于商業(yè)或者非法用途,否則,一切后果請用戶自負。本站信息來自網(wǎng)絡(luò)收集整理,版權(quán)爭議與本站無關(guān)。您必須在下載后的24個小時之內(nèi),從您的電腦或手機中徹底刪除上述內(nèi)容。如果您喜歡該程序或內(nèi)容,請支持正版,購買注冊,得到更好的正版服務(wù)。我們非常重視版權(quán)問題,如有侵權(quán)請郵件[admin@lxwl520.com]與我們聯(lián)系進行刪除處理。敬請諒解!