开发者

how to get and use codeigniter cookies?

I am trying to use codeigniter cookies so that i can bookmark some topic , i don't know how to get cookies vale and use it to display bookmarked item in the user browser , it doesn't work when i try to display cokies value using print_r(); please help how to proceed. Thanks

function index(){
    $this->load->helper('cookie');

    $data['title'] = 'some bookmark';
    $cookie = array(
        'name' =>'mycookie',
        'value' => 'some val',
        'expire' => '86500',
        'domain' =>开发者_如何学C '.localhost',
        'path' => '/',
        'prefix' => 'something_'
    );

    set_cookie($cookie);

    $this->load->view('bookmark', $data);

}


Browsers have trouble dealing with localhost (or .localhost) as the domain for cookie storage - they expect a domain to have at least two dots. Try setting the domain to FALSE (or don't set it) while testing.

If that still doesn't work, can you show us how you're retrieving the cookie data?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜