在 config.yml 变量中使用斜杠
Use slash in config.yml variable
我正在尝试在 8p Guzzle
捆绑包 (https://github.com/8p/GuzzleBundle) 的 config.yml
中设置一个变量,如下所示:
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
有点问题,我试图用反斜杠转义,但什么也没有。
我的错误,关注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')
我正在尝试在 8p Guzzle
捆绑包 (https://github.com/8p/GuzzleBundle) 的 config.yml
中设置一个变量,如下所示:
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
有点问题,我试图用反斜杠转义,但什么也没有。
我的错误,关注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')