我在api路由文件中有这条路由
Route::post('/user/register', 'HomeController@register');
并且寄存器功能是
public function register(Request $request) { $user = User::create([ ... ]); return $this->getAccessToken($request); } public function getAccessToken(Request $request) { $url = url('/oauth/token'); $headers = ['Accept' => 'application/json']; $http = new Client; $response = $http->post($url, [ 'headers' => $headers, 'form_params' => [ 'grant_type' => 'password', 'client_id' => 'my_client_id', 'client_secret' => 'my_client_secret', 'username' => 'username', 'password' => 'password' ], ]); return json_decode((string)$response->getBody(), true); }
现在,当我发送post请求到url用户是创建但请求继续加载没有响应和整个应用程序挂起,直到我关闭IDE - phpstorm - 我发送相同的参数到postman相同的URL /oauth/token
,它工作正常.任何帮助或任何人告诉我我失踪了什么?