本文整理匯總了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);
}