python get请求
我根据老师的方法去请求一个本地项目的接口(laravel+vue),程序运行了,没有报错,但是返回的数据是一个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'
请求的接口:
//登录
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' => '账号或密码错误'];
}