ajax 发送post 请求/in_verification 后没有返回信息 并带着参数请求主域名.
Route::any('/in_verification', [\app\controller\SignController::class,'adds']); //登录验证
<?php
namespace app\controller;
use support\Request;
class SignController
{
public function adds(Request $request)
{
$data = $request->post();
if (!isset($data['email'], $data['password'], $data['code'])) {
return json(['code' => 1001, 'msg' => '参数错误']);
}
$email = $data['email'];
$password = $data['password'];
$code = $data['code'];
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
var_dump(1);
return json(['code' => 1002, 'msg' => '邮箱地址格式不正确']);
}
// 处理其他逻辑...
// 返回响应
return json(['code' => 200, 'msg' => '请求成功']);
}
}
"require": {
"php": ">=7.2",
"workerman/webman-framework": "^1.4.7",
"monolog/monolog": "^2.0",
"psr/container": "^1.1.1",
"webman/blade": "^1.5",
"webman/console": "^1.2.12",
"illuminate/database": "^10.9",
"illuminate/pagination": "^10.9",
"illuminate/events": "^10.9",
"symfony/var-dumper": "^6.2",
"pragmarx/google2fa": "^8.0",
"bacon/bacon-qr-code": "^2.0"
},
$data = $request->post();
改成
$email = $request->input('email');
$password = $request->input('password');
$code = $request->input('code');
感谢回答,测试了和那个没啥关系.
页面跳转后,之前
/in_verification
的请求结果在network里就看不到了,这是正常的。从截图http头看
/in_verification
返回了49字节的数据。应该是你前端收到返回数据后做了跳转请求之类的,检查下前端代码吧。
还有你貌似开了代理,代理去掉试下,避免代理影响。
好的 感谢,确实是前端的问题,已解决.