What is the difference between "render a view" and send the response using the Response's method "sendResponse()"?
Posted
by
Green
on Stack Overflow
See other posts from Stack Overflow
or by Green
Published on 2012-06-27T20:00:29Z
Indexed on
2012/06/27
21:16 UTC
Read the original article
Hit count: 110
I've asked a question about what is "rendering a view". Got some answers:
Rendering a view means showing up a View eg html part to user or browser.
and
So by rendering a view, the MVC framework has handled the data in the controller and done the backend work in the model, and then sends that data to the View to be output to the user.
and
render just means to emit. To print. To echo. To write to some source (probably stdout).
but don't understand then the difference between rendering a view
and using the Response
class to send the output to the user using its sendResponse()
method. If render a view
means to echo the output to the user then why sendResponse()
exists and vise versa? sendResponse()
exactly sends headers and after headers outputs the body. They solve the same tasks but differently? What is the difference?
© Stack Overflow or respective owner