I've just started using Symfony. I want to echo the $bookid when I call a URL like book/5 , but I stuck somewhere.
Here's my DefaultController.php file
namespace AppBundle\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class DefaultController extends Controller { /** * @Route("/book/{id}", name="book") */ public function indexAction() { return $this->render('default/index2.html.php'); } } file: /Myproject/app/Resources/views/default/index2.html.php
<?php echo $id; ?> When I call the book/6 , I get a blank page. What's missing? Do I need to change somewhere else, too?