@@ -63,7 +63,8 @@ Before diving into this, test it out!
6363
6464.. tip ::
6565
66- If you setup a proper virtual host in :doc: `Apache or Nginx </cookbook/configuration/web_server_configuration >`,
66+ If you setup a proper virtual host in
67+ :doc: `Apache or Nginx </cookbook/configuration/web_server_configuration >`,
6768 replace ``http://localhost:8000 `` with your host name - like
6869 ``http://symfony.dev/app_dev.php/lucky/number ``.
6970
@@ -80,22 +81,6 @@ and is where you build the page. The only rule is that a controller *must*
8081return a Symfony :ref: `Response <component-http-foundation-response >` object
8182(and you'll even learn to bend this rule eventually).
8283
83- .. sidebar :: What's the ``app_dev.php`` in the URL?
84-
85- Great question! By including ``app_dev.php `` in the URL, you're executing
86- Symfony through a file - ``web/app_dev.php `` - that boots it in the ``dev ``
87- environment. This enables great debugging tools and rebuilds cached
88- files automatically. For production, you'll use clean URLs - like
89- ``http://symfony.dev/lucky/number `` - that execute a different file -
90- ``app.php `` - that's optimized for speed.
91-
92- When you visit the ``http://localhost:8000 `` URL in your browser, you're
93- executing your Symfony application in the ``dev `` environment. To visit
94- your application in the ``prod `` environment, visit the ``http://localhost:8000/app.php ``
95- URL instead.
96-
97- To learn more about this and environments, see :ref: `book-page-creation-prod-cache-clear `.
98-
9984Creating a JSON Response
10085~~~~~~~~~~~~~~~~~~~~~~~~
10186
@@ -132,7 +117,7 @@ Just add a second method to ``LuckyController``::
132117
133118Try this out in your browser:
134119
135- http://localhost:8000/app_dev.php/ api/lucky/number
120+ http://localhost:8000/api/lucky/number
136121
137122You can even shorten this with the handy :class: `Symfony\\ Component\\ HttpFoundation\\ JsonResponse `::
138123
@@ -253,7 +238,7 @@ The best part is that you can access this value and use it in your controller::
253238
254239Try it by going to ``/lucky/number/XX `` - replacing XX with *any * number:
255240
256- http://localhost:8000/app_dev.php/ lucky/number/7
241+ http://localhost:8000/lucky/number/7
257242
258243You should see *7 * lucky numbers printed out! You can get the value of any
259244``{placeholder} `` in your route by adding a ``$placeholder `` argument to
@@ -410,7 +395,7 @@ to put the content into the middle of the ``base.html.twig`` layout.
410395
411396Refresh to see your template in action!
412397
413- http://localhost:8000/app_dev.php/ lucky/number/9
398+ http://localhost:8000/lucky/number/9
414399
415400If you view the source code, you now have a basic HTML structure thanks to
416401``base.html.twig ``.
0 commit comments