Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace AppBundle\Controller;
- use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
- use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
- use Symfony\Bundle\FrameworkBundle\Controller\Controller;
- use Symfony\Component\HttpFoundation\Cookie;
- use Symfony\Component\HttpFoundation\JsonResponse;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\HttpFoundation\Response;
- use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
- class IndexController extends Controller
- {
- /**
- * @Route("/form/")
- * @Method("GET")
- */
- public function getFormAction()
- {
- return new Response('<form method="post"><input type="text" name="text"> <input type="submit"></form>');
- }
- /**
- * @Route("/form/")
- * @Method("POST")
- */
- public function postFormAction(Request $request)
- {
- return new Response($request->request->get('text', 'brak danych'));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement