@@ -61,37 +61,24 @@ random) number and prints it. To do that, create a "Controller class" and a
6161 }
6262 }
6363
64- "Controller class" is a convenient way to group several "controllers" together.
65-
6664Before diving into this, test it out! If you are using PHP's internal web server
6765go to:
6866
6967 http://localhost:8000/lucky/number
7068
71- If you set up a proper virtual host in Apache or Nginx replace ``http://localhost:8000 ``
72- with your host name and add the name of the development front controller file you
73- are using `` web/app_dev.php `` :
69+ If you set up a virtual host in Apache or Nginx replace ``http://localhost:8000 ``
70+ with your host name and add `` app_dev.php `` to make sure Symfony loads in the "dev"
71+ environment :
7472
7573 http://symfony.dev/app_dev.php/lucky/number
7674
7775If you see a lucky number being printed back to you, congratulations! But before
7876you run off to play the lottery, check out how this works.
7977
80- The ``@Route `` above ``numberAction() `` method is called an :term: `annotation `
81- and defines the route so that :doc: `Router </book/routing >` can match the incoming URL
82- (``http://localhost:8000/lucky/number ``) to a specific route (``/lucky/number ``)
83- and therefore returns information about the route, including the controller method
84- that should be executed. The correct controller from the matched route is executed
85- and the code inside the controller creates and returns the appropriate ``Response ``
86- object.
87-
88- .. note ::
89-
90- You can also write routes in YAML, XML or PHP: you will learn about
91- this in the :doc: `Routing </book/routing >` chapter. If you look closer
92- the above example has tabs that show you how each format looks - all three additional
93- formats use routing configuration file to define routes. Actually, most
94- routing examples in the docs have tabs that show you how each format looks.
78+ The ``@Route `` above ``numberAction() `` method is called an *annotation * and it
79+ defines the URL pattern. You can also write routes in YAML (or other formats):
80+ read about this in the :doc: `routing </book/routing >` chapter. Actually, most
81+ routing examples in the docs have tabs that show you how each format looks.
9582
9683Creating a JSON Response
9784~~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments