Welcome Guest, Not a member yet? Register   Sign In
why is setcookie part of input class
#1

[eluser]Unknown[/eluser]
I am confused why setcookie() is part of input class. I would think it should be part of the output class. The input class (to me) is for extracting data/headers from the HTTP request -- and, not for setting response headers.

Thanks.
#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums!

At the start of a HTTP transaction, a cookie is part of the server input. It's sent to the server from your browser, along with other server input (such as POST or GET data).

I agree, setting a cookie is technically output, but it doesn't make sense splitting up the cookie methods, as that instantly means the Input class is coupled with (or dependent on) the Output class, which doesn't really make much sense.

I think it's more of a practical design decision that helps keep code more modular with minimal dependencies.




Theme © iAndrew 2016 - Forum software by © MyBB