0

当我关闭浏览器时,Cookie 会消失。当我再次打开浏览器时,我看不到它。我的代码是

    $this->sesdata = array(
                    'shop_user'  => $username,
                    'shop_password'  => $password,
                    'logged_in' => TRUE
                              );

    $this->CI->session->set_userdata($this->sesdata);


    $this->cookie = array(
        'name'   => 'user',
        'value'  => $username,
        'expire' => time()+86500,
        'domain' => '',
        'path'   => '/',
        'prefix' => '',
    );

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

    $this->cookie1 = array(
        'name'   => 'pass',
        'value'  => $password,
        'expire' => time()+86500,
        'domain' => '',
        'path'   => '/',
        'prefix' => '',
    );

    $this->CI->input->set_cookie($this->cookie1);
4

1 回答 1

0

的值expire应该只是一个数字。不要添加当前时间,因为传递的值是从现在开始应该持续的秒数。有关更多详细信息,请参阅文档

于 2013-09-04T17:55:47.160 回答