从symfony函数运行命令行

时间:2017-11-23 02:11:01

标签: php html css css3 symfony

我喜欢从symfony函数运行:php sendnotifications.php(路径:C:\ wamp64 \ bin \ php \ php5.6.25 \ php.exe sendnotifications.php)

public function reserverHebAction(Request $request,$idHebergement)
{
    $em = $this->getDoctrine()->getManager();
    $ReservationHebergement = new ReservationHebergement();
    $form = $this->createForm(ReserverType::class, $ReservationHebergement);


    $hebergement=$em->getRepository('govoyagereverseBundle:Hebergement')
        ->find($idHebergement);

    if ($form->handleRequest($request)->isValid() ){
        $hebergement->setDisponibilite($hebergement->getDisponibilite() ==0);
        $user = $this->container->get('security.token_storage')->getToken()->getUser();
        $em = $this->getDoctrine()->getManager();
        $em->persist($hebergement);//insert into model
        $em->flush();//execution de la requete

        $ReservationHebergement->setNomUtilisateurH($user);
        $ReservationHebergement->setIdhebergement($idHebergement);

        $em->persist($ReservationHebergement);
        $em->flush();
        //************sms-***************************************
        /**********I I NEED TO EXCUTE IT HERE **************
        //*******sms-*****************************

        return $this->redirectToRoute('rechercheHeb');
    }
    return $this->render(
        '@govoyagegestionHebergementAdmin/hebergement/reserverHeb.html.twig',
        array('f2' => $form->createView())
    );
}

1 个答案:

答案 0 :(得分:0)

您应该可以使用execshell_exec方法来执行您特别要求(here's an answer discussing the difference)的操作,但我建议您导入所需的任何功能并运行它。