@@ -329,41 +329,14 @@ and the routing of different URLs to different parts of your application
329329is done internally. This solves both problems with the original approach.
330330Almost all modern web apps do this.
331331
332- Stay Organized
333- ~~~~~~~~~~~~~~
334-
335- Inside your front controller, you have to figure out which code should be
336- executed and what the content to return should be. To figure this out, you'll
337- need to check the incoming URI and execute different parts of your code depending
338- on that value. This can get ugly quickly::
339-
340- // index.php
341- use Symfony\Component\HttpFoundation\Request;
342- use Symfony\Component\HttpFoundation\Response;
343-
344- $request = Request::createFromGlobals();
345- $path = $request->getPathInfo(); // the URI path being requested
346-
347- if (in_array($path, array('', '/'))) {
348- $response = new Response('Welcome to the homepage.');
349- } elseif ('/contact' === $path) {
350- $response = new Response('Contact us');
351- } else {
352- $response = new Response('Page not found.', Response::HTTP_NOT_FOUND);
353- }
354- $response->send();
355-
356- Solving this problem can be difficult. Fortunately it's *exactly * what Symfony
357- is designed to do.
358-
359332.. index ::
360333 single: HTTP; Symfony request flow
361334
362335The Symfony Application Flow
363336~~~~~~~~~~~~~~~~~~~~~~~~~~~~
364337
365- When you let Symfony handle each request, life is much easier. Symfony follows
366- the same simple pattern for every request:
338+ Symfony will operate in this front-controller file to handle each incoming
339+ request. Symfony follows the same simple pattern for every request:
367340
368341.. _request-flow-figure :
369342
0 commit comments