0

我正在尝试在捆绑包( https://github.com/8p/GuzzleBundle )中设置一个变量config.yml8p Guzzle如下所示

guzzle:
    clients:
        identity_api:
            base_url: "%some.url%:5000/v2.0"

并做一个典型的得到:

$client = $this->container->get('guzzle.client.identity_api');
$response = $client->get('/users')

但我收到一条错误消息,告诉我请求的 url 是:

http://somedomain.com:5000/users

我认为是与slash,我试图用反斜杠转义但没有。

4

1 回答 1

0

我的错误,遵循http://docs.guzzlephp.org/en/latest/quickstart.html#making-a-request

base_uri            URI             Result
http://foo.com      /bar            http://foo.com/bar
http://foo.com/foo  /bar            http://foo.com/bar
http://foo.com/foo  bar             http://foo.com/bar
http://foo.com/foo/ bar             http://foo.com/foo/bar
http://foo.com      http://baz.com  http://baz.com
http://foo.com/?bar bar             http://foo.com/bar

我必须删除slash用户请求。

$client = $this->container->get('guzzle.client.identity_api');
$response = $client->get('users')
于 2016-04-26T09:56:59.017 回答