Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I show cookies in to codeigniter?

how can I show cookies?

i want see cookies in codeigniter.

session i see :

print_r($this->session->all_userdata());

But cookies ?

like image 679
listratov Avatar asked Oct 08 '22 16:10

listratov


2 Answers

I took a look at system/core/Input.php:

function _fetch_from_array(&$array, $index = '', $xss_clean = FALSE)
{
    if ( ! isset($array[$index]))
    {
        return FALSE;
    }

    if ($xss_clean === TRUE)
    {
        return $this->security->xss_clean($array[$index]);
    }

    return $array[$index];
}

function cookie($index = '', $xss_clean = FALSE)
{
    return $this->_fetch_from_array($_COOKIE, $index, $xss_clean);
}

As far as I can see, you cannot show all cookies with $this->input->cookie(). Only one at a time.

If you really want to see all the cookies, just try var_dump($_COOKIE).

Or if you need show one cookie only, specify your_key: $this->input->cookie('your_key')

Hope this helps =)

like image 114
Rocco Avatar answered Oct 12 '22 11:10

Rocco


Use $this->input->cookie().

For more options use the cookie helper: http://codeigniter.com/user_guide/helpers/cookie_helper.html

like image 29
Yan Berk Avatar answered Oct 12 '22 10:10

Yan Berk