Skip to content

Commit 000af42

Browse files
committed
Adjust route handler doc
1 parent 4082182 commit 000af42

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

website/routes/doc.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ The content-type of the response can be set explicitly in a PHP route handler.
320320

321321
The echoed content of the PHP file is taken.
322322

323-
If the HTML content contains a `html` element or a `Doctype`, the HTML content is taken as is.
323+
If the HTML content contains an `html` element or a `Doctype`, the HTML content is output as it is.
324324

325325
Otherwise the Twig layout is determined via the layout comment `<!-- layout: my-layout.html.twig -->` in the HTML content.
326326
The page title is determined by the H1-H3 headings in the HTML content.
@@ -330,11 +330,12 @@ The layout is applied and output together with the page title and the HTML conte
330330

331331
If you want finer control over the HTTP response, you can return a string, an array or a `Symfony\Component\HttpFoundation\Response` object.
332332

333-
If the return value is a string, it is output as is with a `text/html` content-type.
333+
If the return value is a string, it is output as HTML with the content type `text/html`.
334334

335-
If return value is an array, it is JSON encoded and output with a `application/json` content-type.
335+
If the return value is an array, it is JSON encoded and output with the content-type `application/json`.
336336

337-
If return value is a `Response` object, it is output as is.
337+
If the return value is a `Symfony\Component\HttpFoundation\Response` object, it is output unchanged together with the underlying content type.
338+
There are several response subclasses to help you return JSON, redirect, stream file downloads and more.
338339

339340
### Events
340341

0 commit comments

Comments
 (0)