我喜欢从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())
);
}
答案 0 :(得分:0)
您应该可以使用exec
或shell_exec
方法来执行您特别要求(here's an answer discussing the difference)的操作,但我建议您导入所需的任何功能并运行它。