Cookie expires on session in Codeigniter

I set a cookie in my codeigniter application using the following code. Works fine .. but the cookie gets expired in the session. Please, help

$cookie = array(
        'name'   => 'tvcUsername',
        'value'  => $email,
        'expire' => time()+86500,
        'domain' => 'http://localhost/tvc',
        'path'   => '/',
        'prefix' => '',

    );

    $this->input->set_cookie($cookie);

Thanks in advance

+1
source share
2 answers

Two things I can think of:

a) localhost is not a valid domain, so cookies will not be saved for all browsers. Create yourself a HOST for "my.dev.server" or "localhost.dev" and specify 127.0.0.1 (you may also need to configure apache to respond to this name, but first try just changing the HOSTS file first)

b) , "" - ? "localhost.dev" ( "http://" "/tvc" - , .

+1

All Articles