python get請(qǐng)求
我根據(jù)老師的方法去請(qǐng)求一個(gè)本地項(xiàng)目的接口(laravel+vue),程序運(yùn)行了,沒有報(bào)錯(cuò),但是返回的數(shù)據(jù)是一個(gè)html文件,不是提示信息,這是怎么回事呀
返回信息:
b'<!DOCTYPE html>\n<html>\n<head>\n? ? <meta charset="utf-8">\n? ? <meta http-equiv="X-UA-Compatible" content="IE=edge">\n? ? <meta name="viewport" content="width=device-width, initial-scale=1">\n? ? <meta name="csrf-token" content="JGB4wfEKB4EgfOlJhtG2QBywhC7kNFKvzj8rBXwk">\n? ? <title>\xe6\x96\xb0\xe7\x94\x9f\xe6\x8a\xa5\xe5\x88\xb0</title>\n? ? <style>\n? ? html{\n? ? ? ? background-color: rgba(0, 188, 212, 0.15);\n? ? ? ? margin:0;\n? ? ? ? padding:0;\n? ? ? ? \n? ? }\n? ? </style>\n</head>\n<body>\n<div id="app"></div>\n<script src="/js/manifest.js"></script>\n<script src="/js/vendor.js"></script>\n<script src="/js/app.js"></script>\n</body>\n</html>\n'
請(qǐng)求的接口:
//登錄
public function login(){
????$account = request('account');
????$password = request('password');
????$res=login::login($account);
????if($res!=""){
????????if($password == $res->password){
????????????????session(['admin_id'=>$account]);
????????????????if($res->status == 1){
????????????????????return ['code' => 2, 'msg' => '登錄成功','status' => $res->type];
????????????????}else{
????????????????????return ['code' => 1, 'msg' => '登錄成功','status' => $res->type];
????????????????}
??????????}
????}
????return ['code' => 0, 'msg' => '賬號(hào)或密碼錯(cuò)誤'];
}
2019-12-30
你的返回格式?jīng)]轉(zhuǎn)化。