Advertisement
sanjiisan

Untitled

Sep 11th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <?php
  2.  
  3. namespace AppBundle\Controller;
  4.  
  5. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  6. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  7. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  8. use Symfony\Component\HttpFoundation\Cookie;
  9. use Symfony\Component\HttpFoundation\JsonResponse;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Component\HttpFoundation\Response;
  12. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  13.  
  14. class IndexController extends Controller
  15. {
  16.  
  17. /**
  18. * @Route("/form/")
  19. * @Method("GET")
  20. */
  21. public function getFormAction()
  22. {
  23. return new Response('<form method="post"><input type="text" name="text"> <input type="submit"></form>');
  24. }
  25.  
  26. /**
  27. * @Route("/form/")
  28. * @Method("POST")
  29. */
  30. public function postFormAction(Request $request)
  31. {
  32. return new Response($request->request->get('text', 'brak danych'));
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement