本文整理汇总了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));
}
示例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');
}
示例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();
}
}
}
示例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;
}
示例5: getHttpMethod
/**
* Get $_SERVER['REQUEST_METHOD']
*/
public function getHttpMethod()
{
return request::getMethod();
}
示例6: redirect
public static function redirect($location)
{
request::getMethod() == 'GET' ? self::movedPermanently($location) : self::seeOther($location);
}