小编Car*_*Ihl的帖子

每当我尝试使用 guzzle 请求 localhost:8000/any 时,Laravel 服务器就会挂起

如果我提出任何请求http://localhost:8000http://127.0.0.1:8000它挂在状态挂起。(正如这里https://github.com/guzzle/guzzle/issues/1857

有人告诉我这与暴饮暴食无关,我最好在这里问一下。

我在关注 laravel.com/docs/5.4/passport 时偶然发现了这个问题

这是挂起的代码:

$response = $http->post('http://your-app.com/oauth/token', [
    'form_params' => [
        'grant_type' => 'authorization_code',
        'client_id' => 'client-id',
        'client_secret' => 'client-secret',
        'redirect_uri' => 'http://example.com/callback',
        'code' => $request->code,
    ],
]);
Run Code Online (Sandbox Code Playgroud)

我尝试向工作 API 路由发出 GET 和 POST 请求(用邮递员测试),但在使用 guzzle 调用相同路由时它仍然挂起。

那么有没有办法在使用时向我自己的 API 发出请求php artisan serve

php localhost laravel guzzle

7
推荐指数
1
解决办法
2880
查看次数

标签 统计

guzzle ×1

laravel ×1

localhost ×1

php ×1