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


PHP request::getMethod方法代码示例

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


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

示例1: affichageMatierePremiereAction

 public function affichageMatierePremiereAction(request $request)
 {
     $em = $this->getDoctrine()->getManager();
     //Partie Recherche et trie des composants
     if ('POST' == $request->getMethod()) {
         //recheche basique par composant
         $listComposant = $em->getRepository('ICAdministrationBundle:Composant')->getStockByCritere($request->get('formComposantInterne'));
     } else {
         $listComposant = $em->getRepository('ICAdministrationBundle:Composant')->getStockByCritere(0);
     }
     $formComposant = $this->createForm(new AddComposantType($this->generateUrl('ic_administration_mp_add')));
     return $this->render('ICAdministrationBundle:MP:affichage.html.twig', array('partie' => 'Administration', 'form' => $formComposant->createView(), 'composants' => $listComposant));
 }
开发者ID:toko30,项目名称:GestStock,代码行数:13,代码来源:MatierePremiereController.php

示例2: indexAction

 public function indexAction(request $request)
 {
     $session = $this->getRequest()->getSession();
     if ($request->getMethod() == 'POST') {
         $session->clear();
         $username = $request->get('usuario');
         $password = $request->get('password');
         //$em = $this->getDoctrine()->getManager();
         $query = $this->getDoctrine()->getRepository('usuariosBundle:PerfilUsuario')->createQueryBuilder('perfil')->select('perfil', 'usuario', 'tipo_usuario')->innerJoin('usuariosBundle:Usuarios', 'usuario', 'WITH', 'perfil.usuario = usuario.id')->innerJoin('usuariosBundle:TipoUsuario', 'tipo_usuario', 'WITH', 'usuario.tipoUsuario = tipo_usuario.id')->where('perfil.nombreUsuario = :user')->setParameter('user', $username)->getQuery();
         $user = $query->getArrayResult();
         $passwords = $this->getDoctrine()->getRepository('usuariosBundle:Passwords')->findOneBy(array('perfil' => $user[0]['id'], 'activo' => true));
         if ($user) {
             $factory = $this->get('security.encoder_factory');
             $codificador = $factory->getEncoder($passwords);
             $validador = $codificador->isPasswordValid($passwords->getPassword(), $password, $passwords->getSalt());
             if ($validador) {
                 $session = $request->getSession();
                 $session->set("email", $user[0]['email']);
                 $session->set("perfil_activo", $user[0]['activo']);
                 $session->set("pass_activo", $passwords->getActivo());
                 if ($session->get('perfil_activo') == 1) {
                     if ($session->get('pass_activo') == 1) {
                         $session->set("usuario_id", $user[0]['id']);
                         $session->set("autenticado", true);
                         $session->set("nombre_usuario", $user[0]['nombreUsuario']);
                         $session->set("nombres", $user[1]['nombres']);
                         $session->set("tipo_usuario", $user[2]['nombre']);
                         $session->set("id_tipo_usuario", $user[2]['id']);
                         return $this->render('inicialBundle:Default:index.html.twig');
                     } else {
                         $this->get('session')->getFlashBag()->add('warning', 'Clave Inactiva debe actualizar su clave');
                     }
                 } else {
                     $this->get('session')->getFlashBag()->add('danger', 'Usuario Inactivo Contactar con el administrador del sistema');
                     return $this->render('inicialBundle:Default:index.html.twig');
                 }
             } else {
                 $this->get('session')->getFlashBag()->add('danger', 'Datos incorrectos');
                 return $this->render('inicialBundle:Default:index.html.twig');
             }
         } else {
             $this->get('session')->getFlashBag()->add('danger', 'Datos incorrectos');
             return $this->render('inicialBundle:Default:index.html.twig');
         }
     }
     return $this->render('inicialBundle:Default:index.html.twig');
 }
开发者ID:kcoronil,项目名称:feyalegria,代码行数:47,代码来源:DefaultController.php

示例3: initSettings

 public function initSettings()
 {
     if ($this->_block !== null) {
         $this->_block->getSettings();
         if (request::getMethod() === 'POST') {
             foreach ($this->_defaultSettings as $name => $a) {
                 $title = $a['title'];
                 $default = $a['default'];
                 if (isset($_POST[$name])) {
                     $this->_block->setOption($name, $_POST[$name], $default);
                 }
             }
             $this->_block->save();
             $this->back();
         }
     }
 }
开发者ID:alexqwert,项目名称:kanon,代码行数:17,代码来源:widgetController.php

示例4: execute

 /**
  * @see http://php.net/manual/en/language.oop5.late-static-bindings.php
  * @return ModuleAbstract
  */
 public function execute()
 {
     $response = null;
     switch (strtoupper($this->request->getMethod())) {
         case 'POST':
             $response = static::post();
             break;
         case 'PUT':
             $response = static::put();
             break;
         case 'DELETE':
             $response = static::delete();
             break;
         case 'GET':
             $response = static::get();
             break;
         default:
             throw new Http\NotImplemented();
             break;
     }
     $this->response = $response;
     return $this;
 }
开发者ID:nlegoff,项目名称:statme,代码行数:27,代码来源:ProcessAbstract.php

示例5: getHttpMethod

 /**
  * Get $_SERVER['REQUEST_METHOD']
  */
 public function getHttpMethod()
 {
     return request::getMethod();
 }
开发者ID:alexqwert,项目名称:kanon,代码行数:7,代码来源:controllerPrototype.php

示例6: redirect

 public static function redirect($location)
 {
     request::getMethod() == 'GET' ? self::movedPermanently($location) : self::seeOther($location);
 }
开发者ID:alexqwert,项目名称:kanon,代码行数:4,代码来源:response.php


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