在浏览器上显示
HTTP/1.1 302 Found Server: workerman Location: https://www.baidu.com/saiya/auth/544433385 Connection: keep-alive Content-Type: text/html;charset=utf-8 Content-Length: 0
浏览器不会跳转到这个链接上,是怎么回事呢?
你把http都当内容输出了,webman重定向是 return redirect('网址');
return redirect('网址');
代码是这样的 public function createCode(Request $request): string { $param = $request->all(); $code = Str::random(40); $this->autoloader->setAuthorizationCode($code,$param['client_id'],$param['redirect_uri']); $url = $param['redirect_uri'].'?code='.$code.'&state='.$param['state'].'&dueros_uid='.$param['dueros_uid']; echo $url; return redirect($url); }
echo 输出内容 : https://xiaodu-dbp.baidu.com/saiya/auth/57128b6ef1c9b81?code=byULaPptoGfsyvjxnr&state=f9f98760c3c4ef18b16ef226&dueros_uid=f9f987b60c3c4ef18b16ef226
你把http都当内容输出了,webman重定向是
return redirect('网址');
代码是这样的
public function createCode(Request $request): string
{
$param = $request->all();
$code = Str::random(40);
$this->autoloader->setAuthorizationCode($code,$param['client_id'],$param['redirect_uri']);
$url = $param['redirect_uri'].'?code='.$code.'&state='.$param['state'].'&dueros_uid='.$param['dueros_uid'];
echo $url;
return redirect($url);
}
echo 输出内容 :
https://xiaodu-dbp.baidu.com/saiya/auth/57128b6ef1c9b81?code=byULaPptoGfsyvjxnr&state=f9f98760c3c4ef18b16ef226&dueros_uid=f9f987b60c3c4ef18b16ef226