swlib / saber

⚔️ Saber, PHP异步协程HTTP客户端 | PHP Coroutine HTTP client - Swoole Humanization Library
https://packagist.org/packages/swlib/saber
Apache License 2.0
976 stars 124 forks source link

Swlib\Saber::create 时报错 #117

Open weicut opened 3 years ago

weicut commented 3 years ago
$saber = Swlib\Saber::create([
//    'base_uri' => 'http://localhost:9988',
    'exception_report' => 0,
    'use_pool' => 50
]);

$result =  $saber->get('http://localhost:9988/', [
    'retry_time' => 3
]);

如果 create 时不加 base_uri,会报如下错误:

image

twose commented 3 years ago

为什么要这么用呢 0.0

weicut commented 3 years ago

为什么要这么用呢 0.0

因为感觉在 get 方法中做会更友好,同样也可以根据 url 分析出 uri,不用强绑在实例中,Guzzle HTTP 组件也是采用这样的做法哦