In normal PHP, to set a cookie you need to run the following code:
bool setcookie ( string $name [, string $value = "" [, int $expire = 0 [, string $path = "" [, string $domain = "" [, bool $secure = FALSE [, bool $httponly = FALSE ]]]]]] )
And to get it to work on localhost, string $domain
needs to be false
.
To set a cookie with Phalcon, you need to run the following code:
public set (mixed $name, [mixed $value], [mixed $expire], [mixed $path], [mixed $secure], [mixed $domain], [mixed $httpOnly])
However, when I try and send the [mixed $domain]
as false
I get the following error:
Parameter 'domain' must be a string
Setting it to ''
, null
, 'localhost'
, '.localhost'
, or '127.0.0.1'
doesn't throw an error, but doesn't save the cookie.
The next thing my code does is $this->response->redirect()
.
How can I get cookies to work on localhost?