本文整理汇总了PHP中Symfony\Component\HttpFoundation\Response::getTargetUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::getTargetUrl方法的具体用法?PHP Response::getTargetUrl怎么用?PHP Response::getTargetUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Response
的用法示例。
在下文中一共展示了Response::getTargetUrl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logResponse
/**
* Logs a response
*
* @param Response $response
*/
protected function logResponse(Response $response)
{
if ($response instanceof RedirectResponse) {
$this->logger->info('< ' . $response->getStatusCode() . ' ' . $response->getTargetUrl());
} else {
$this->logger->info('< ' . $response->getStatusCode());
}
}
示例2: logResponse
/**
* Logs a response.
*
* @param Response $response
*/
protected function logResponse(Response $response)
{
$response->headers->set('trace-token', TracingRequest::getInstance()->getTraceId());
if ($response instanceof RedirectResponse) {
$this->logger->info('< ' . $response->getStatusCode() . ' ' . $response->getTargetUrl());
} else {
$this->logger->info('HTTP response: ' . $response->getStatusCode() . ' #TRACE#{"event":"response.send"}');
}
}
示例3: logResponse
/**
* @param \Symfony\Component\HttpFoundation\Response $response
*
* @return void
*/
protected function logResponse(Response $response)
{
if ($response instanceof RedirectResponse) {
$message = sprintf('%s Response %s [%s], target URL %s', $this->getSapi(), APPLICATION, $response->getStatusCode(), $response->getTargetUrl());
} else {
$message = sprintf('%s Response %s [%s]', $this->getSapi(), APPLICATION, $response->getStatusCode());
}
$this->logger->info($message, ['response' => $response]);
}
示例4: collect
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
if ($response instanceof RedirectResponse) {
$this->data['redirect'] = true;
$this->data['url'] = $response->getTargetUrl();
if ($this->controllers->contains($request)) {
$this->data['route'] = $this->guessRoute($request, $this->controllers[$request]);
}
}
}
示例5: collect
/**
* {@inheritdoc}
*/
public function collect(Request $request, Response $response, \Exception $exception = null)
{
if ($response instanceof RedirectResponse) {
$this->data['redirect'] = true;
$this->data['url'] = $response->getTargetUrl();
if ($this->controllers->contains($request)) {
$controller = $this->controllers[$request];
if (is_array($controller)) {
$controller = $controller[0];
}
if ($controller instanceof RedirectController) {
$this->data['route'] = $request->attributes->get('_route', 'n/a');
}
}
}
}
示例6: logResponse
/**
* Logs a response.
*
* @param Response $response
*/
protected function logResponse(Response $response)
{
$message = '< ' . $response->getStatusCode();
if ($response instanceof RedirectResponse) {
$message .= ' ' . $response->getTargetUrl();
}
$this->logger->log(LogLevel::DEBUG, $message);
}