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


PHP Request::getMEthod方法代码示例

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


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

示例1: indexAction

 /**
  *@Route("/search/", name="search")
  */
 public function indexAction(Request $request)
 {
     if ($request->getMEthod() == 'POST') {
         $title = $request->get('search');
         //echo "<div class=\"searchText\">Search Results</div><hr/>";
         $connect = $this->get('database_connection');
         $search1['result'] = $connect->fetchAll("select DISTINCT Nm From companies");
         $Search_terms = explode(' ', $title);
         //splits search terms at spaces
         $query = "SELECT * FROM companies WHERE ";
         $query1 = "SELECT * FROM items WHERE ";
         $str = mysql_real_escape_string($title);
         $query .= " Nm LIKE '%{$str}%' ";
         $query1 .= " Nm LIKE '%{$str}%' ";
         $searsh['result'] = $connect->fetchAll($query);
         $search['result'] = $connect->fetchAll($query1);
         $menuRepository = $this->getDoctrine()->getManager()->getRepository('AppBundle:Menu');
         $menu['result'] = $menuRepository->showAction();
         $data = ['search1' => $search1['result'], 'menu' => $menu['result'], 'shearch' => $searsh['result'], 'search' => $search['result']];
         return $this->render('AppBundle:Default:index2.html.twig', compact('data'));
     }
 }
开发者ID:iondomnicu,项目名称:CIPC_BinaMarket,代码行数:25,代码来源:SearchController.php

示例2: indexAction

 /**
  *@Route("/search/", name="search")
  */
 public function indexAction(Request $request)
 {
     if ($request->getMEthod() == 'POST') {
         $title = $request->get('search');
         //echo "<div class=\"searchText\">Search Results</div><hr/>";
         $connect = $this->get('database_connection');
         //$search1['result'] = $connect->fetchAll("select DISTINCT Nm From companies");
         $stmt = $this->getDoctrine()->getManager()->getConnection()->prepare("select DISTINCT Nm From companies");
         $stmt->execute();
         $search1['result'] = $stmt->fetchAll();
         $Search_terms = explode(' ', $title);
         //splits search terms at spaces
         $searchCondition = '';
         ////
         foreach ($Search_terms as $i => $term) {
             if ($i != 0) {
                 $searchCondition .= ' OR ';
             }
             $searchCondition .= ' Nm LIKE :term' . $i . ' ';
         }
         $query = $this->getDoctrine()->getManager()->getConnection()->prepare("SELECT * FROM companies WHERE " . $searchCondition);
         foreach ($Search_terms as $i => $term) {
             $query->bindValue(':term' . $i, $term);
         }
         $search['result'] = $query->fetchAll();
         $query->execute();
         $query1 = $this->getDoctrine()->getManager()->getConnection()->prepare("SELECT * FROM items WHERE Nm LIKE :title");
         $query1->bindValue(':title', $title);
         $query1->execute();
         $search1['result'] = $query1->fetchAll();
         $menuRepository = $this->getDoctrine()->getManager()->getRepository('AppBundle:Menu');
         $menu['result'] = $menuRepository->showAction();
         $data = ['search1' => $search1['result'], 'menu' => $menu['result'], 'shearch' => $search['result'], 'search' => $search1['result']];
         return $this->render('AppBundle:Default:index2.html.twig', compact('data'));
     }
 }
开发者ID:ivanovdumitru,项目名称:practica,代码行数:39,代码来源:SearchController.php

示例3: editAction

 /**
  *@Security("has_role('ROLE_REDACTEUR')")
  */
 public function editAction(Equipe $equipe, Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     $equipe = $em->getRepository("MdyGstBundle:Equipe")->find($equipe->getId());
     if ($equipe == null) {
         throw new NotFoundException('L\'équipe recherchée ["' . $equipe->getId() . '"] n\'a pas été trouvée');
     }
     $form = $this->createForm(new EquipeType(), $equipe);
     if ($request->getMEthod() === "POST") {
         $form->bind($request);
         if ($form->isValid()) {
             $em->persist($equipe);
             $em->flush();
             return $this->redirect($this->generateUrl('mdy_gst_listEquipe'));
         }
     }
     return $this->render('MdyGstBundle:Gst:Equipe/edit.html.twig', array('form' => $form->createView()));
 }
开发者ID:rthreis,项目名称:GST,代码行数:21,代码来源:EquipeController.php


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