那我直接问你问题吧~哈哈哈哈...
大概是这个样子我在本地搭建了一个项目,恩
// url:http://localhost:8000/
use GuzzleHttp\Client;
public function authenticate(Request $request)
{
$http = new \GuzzleHttp\Client();
$headers = ['Authorization' => 'Bearer'];
$client = new \GuzzleHttp\Psr7\Request('POST', 'http://localhost:8000//api/login', [
'form_params' => [
'email' => $request->email,
'password' => $request->password,
]
]);
$response = $http->send($client);
return json_decode((string) $response->getBody(), true);
}
// http://localhost:8000//api/login 的路由
public function authenticate(Request $request)
{
$data['Authorization'] = $request->all();
return response()->json($data);
}
// 想要实现 authenticate 这个function把 email,password传给api/login的authenticate然后他获取到 email,password 返回状态,现在返回是空的...没有获取到值,求解...