Codeigniter-Cookie在internet explorer 8中不起作用

Codeigniter-Cookie在internet explorer 8中不起作用,codeigniter,cookies,internet-explorer-8,Codeigniter,Cookies,Internet Explorer 8,此代码适用于除Internet Explorer 8之外的所有浏览器 $this->input->set_cookie(array( 'name' => 'test_cookie', 'value' => 'hello from cookie', 'expire' => 360000000,

此代码适用于除Internet Explorer 8之外的所有浏览器

 $this->input->set_cookie(array(
                          'name'   => 'test_cookie',
                          'value'  => 'hello from cookie',
                          'expire' => 360000000,
                          'secure' => FALSE
                          ));

        echo get_cookie('test_cookie');
如何解决这个问题?为什么不设置cookie?

试试:

echo $this->input->cookie('test_cookie');

我使用helper中的函数解决了我的问题

function setcookie_ex($name, $value, $expire)
{
    $cookie_path = '/'; $cookie_domain = ''; $cookie_secure = false;

    // Enable sending of a P3P header
    header('P3P: CP="CUR ADM"');

    if (version_compare(PHP_VERSION, '5.2.0', '>='))
       setcookie($name, $value, $expire, $cookie_path, $cookie_domain, $cookie_secure, true);
    else
    setcookie($name, $value, $expire, $cookie_path.'; HttpOnly', $cookie_domain, $cookie_secure);
}

我有一个类似的问题,只有IE会拒绝接受饼干。结果表明,计算机的时区设置不正确(未来将提前17个小时,服务器在澳大利亚时设置为US PST),因此发生的情况是cookie立即过期。

cookie没有设置?如果您不使用codeigniter设置它们会怎么样?您能确认您的代码在FF、CHrome等浏览器上工作吗?此代码在所有浏览器中都工作@AlmasSarsenbayev您是否在浏览器IE上启用了Cookie?Cookie已启用IE,其他网站使用Cookie工作正常感谢我刚才遇到了完全相同的问题-在使用Microsoft为IE11提供的开发虚拟机时。时钟上有“正确”的时间,但被设置为美国太平洋标准时间,所以它实际上是在过去。很难诊断,因为cookie被忽略了!我试过很多方法,但是你的回答让我检查了虚拟机中的时钟。