当前位置: 首页>>代码示例>>PHP>>正文


PHP RedirectResponse::getContent方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpFoundation\RedirectResponse::getContent方法的典型用法代码示例。如果您正苦于以下问题:PHP RedirectResponse::getContent方法的具体用法?PHP RedirectResponse::getContent怎么用?PHP RedirectResponse::getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpFoundation\RedirectResponse的用法示例。


在下文中一共展示了RedirectResponse::getContent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createRedirectResponse

 /**
  * Creates the Response from the view.
  *
  * @param View   $view
  * @param string $location
  * @param string $format
  *
  * @return Response
  */
 public function createRedirectResponse(View $view, $location, $format)
 {
     $content = null;
     if (($view->getStatusCode() == Response::HTTP_CREATED || $view->getStatusCode() == Response::HTTP_ACCEPTED) && $view->getData() != null) {
         $response = $this->initResponse($view, $format);
     } else {
         $response = $view->getResponse();
         if ('html' === $format && isset($this->forceRedirects[$format])) {
             $redirect = new RedirectResponse($location);
             $content = $redirect->getContent();
             $response->setContent($content);
         }
     }
     $code = isset($this->forceRedirects[$format]) ? $this->forceRedirects[$format] : $this->getStatusCode($view, $content);
     $response->setStatusCode($code);
     $response->headers->set('Location', $location);
     return $response;
 }
开发者ID:sblaut,项目名称:FOSRestBundle,代码行数:27,代码来源:ViewHandler.php

示例2: testBroadcast

 public function testBroadcast(MultimediaObject $multimediaObject, Request $request)
 {
     if (($broadcast = $multimediaObject->getBroadcast()) && Broadcast::BROADCAST_TYPE_PUB !== $broadcast->getBroadcastTypeId() && (!($broadcastName = $request->headers->get('PHP_AUTH_USER', false)) || $request->headers->get('PHP_AUTH_PW') !== $broadcast->getPasswd() || $broadcastName !== $broadcast->getName())) {
         $seriesUrl = $this->generateUrl('pumukit_webtv_series_index', array('id' => $multimediaObject->getSeries()->getId()), true);
         $redReq = new RedirectResponse($seriesUrl, 302);
         return new Response($redReq->getContent(), 401, array('WWW-Authenticate' => 'Basic realm="Resource not public."'));
     }
     if ($broadcast && Broadcast::BROADCAST_TYPE_PRI === $broadcast->getBroadcastTypeId()) {
         return new Response($this->render("PumukitWebTVBundle:Index:403forbidden.html.twig", array()), 403);
     }
     return true;
 }
开发者ID:bmartinezteltek,项目名称:PuMuKIT2,代码行数:12,代码来源:MultimediaObjectController.php

示例3: createRedirectResponse

 /**
  * Create the Response from the view
  *
  * @param View   $view
  * @param string $location
  * @param string $format
  *
  * @return Response
  */
 public function createRedirectResponse(View $view, $location, $format)
 {
     $content = null;
     $response = $view->getResponse();
     if ('html' === $format && isset($this->forceRedirects[$format])) {
         $redirect = new RedirectResponse($location);
         $content = $redirect->getContent();
         $response->setContent($content);
     }
     $code = isset($this->forceRedirects[$format]) ? $this->forceRedirects[$format] : $this->getStatusCode($view, $content);
     $response->setStatusCode($code);
     $response->headers->set('Location', $location);
     return $response;
 }
开发者ID:shreyans264,项目名称:symfonyPlayGround,代码行数:23,代码来源:ViewHandler.php

示例4: testGenerateMetaRedirect

 public function testGenerateMetaRedirect()
 {
     $response = new RedirectResponse('foo.bar');
     $this->assertEquals(1, preg_match('#<meta http-equiv="refresh" content="\\d+;url=foo\\.bar" />#', preg_replace(array('/\\s+/', '/\'/'), array(' ', '"'), $response->getContent())));
 }
开发者ID:newism,项目名称:symfony,代码行数:5,代码来源:RedirectResponseTest.php

示例5: sendEmailAction

 /**
  * Request reset user password: submit form and send email
  */
 public function sendEmailAction(Request $request)
 {
     $username = $request->get('username');
     $template = $request->get('template');
     $routereset = $request->get('routereset');
     $type = $request->get('type');
     if (empty($template)) {
         $template = str_replace('::', ':', $this->container->getParameter('sfynx.auth.theme.login')) . 'Resetting:request.html.twig';
     }
     $user = $this->container->get('doctrine')->getManager()->getRepository('SfynxAuthBundle:User')->findOneBy(array('username' => $username));
     if ($request->isXmlHttpRequest()) {
         $response = new JsonResponse();
         if (null === $user) {
             return $response->setData(json_encode(array('text' => 'Identifiant inconnu', 'error' => true, 'type' => 'unknown')));
         } else {
             if ($user->isPasswordRequestNonExpired($this->container->getParameter('fos_user.resetting.token_ttl')) && $type == 'send') {
                 return $response->setData(json_encode(array('text' => 'Vous devez au préalable activer votre compte en cliquant sur le mail de Confirmation d\'inscription reçu', 'error' => true, 'type' => '24h')));
             } else {
                 $tokenGenerator = $this->container->get('fos_user.util.token_generator');
                 $user->setConfirmationToken($tokenGenerator->generateToken());
                 $em = $this->container->get('doctrine')->getManager();
                 $em->persist($user);
                 $em->flush();
                 $this->container->get('session')->set(PiMailerManager::SESSION_EMAIL, $this->container->get('sfynx.auth.mailer')->getObfuscatedEmail($user));
                 $this->container->get('sfynx.auth.mailer')->sendResettingEmailMessage($user, $routereset);
                 $user->setPasswordRequestedAt(new \DateTime());
                 $this->container->get('fos_user.user_manager')->updateUser($user);
                 return $response->setData(json_encode(array('text' => 'Un email vous a été envoyé pour créer un nouveau mot de passe sur le site', 'error' => false)));
             }
         }
     } else {
         if (null === $user) {
             return $this->container->get('templating')->renderResponse($template, array('invalid_username' => $username));
         }
         if ($user->isPasswordRequestNonExpired($this->container->getParameter('fos_user.resetting.token_ttl'))) {
             return $this->container->get('templating')->renderResponse(str_replace('::', ':', $this->container->getParameter('sfynx.auth.theme.login')) . 'Resetting:passwordAlreadyRequested.html.twig');
         }
         $tokenGenerator = $this->container->get('fos_user.util.token_generator');
         $user->setConfirmationToken($tokenGenerator->generateToken());
         $em = $this->container->get('doctrine')->getManager();
         $em->persist($user);
         $em->flush();
         //
         $this->container->get('session')->set(PiMailerManager::SESSION_EMAIL, $this->container->get('sfynx.auth.mailer')->getObfuscatedEmail($user));
         $this->container->get('sfynx.auth.mailer')->sendResettingEmailMessage($user, $routereset);
         $user->setPasswordRequestedAt(new \DateTime());
         $this->container->get('fos_user.user_manager')->updateUser($user);
         try {
             return $this->container->get('templating')->renderResponse($template, array('success' => true));
         } catch (\Exception $e) {
             $response = new RedirectResponse($this->container->get('router')->generate('fos_user_resetting_check_email'));
         }
         return $response->getContent();
     }
 }
开发者ID:pigroupe,项目名称:SfynxAuthBundle,代码行数:58,代码来源:ResettingController.php


注:本文中的Symfony\Component\HttpFoundation\RedirectResponse::getContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。