2012-06-01 39 views

回答

2

我在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); 
} 

據我所看到的,你不能顯示所有Cookie與$this->input->cookie()。一次只有一個。

如果你真的想看到所有的餅乾,只是嘗試var_dump($_COOKIE)

,或者您需要只顯示一個cookie時,指定your_key$this->input->cookie('your_key')

希望這有助於=)

2

使用$this->input->cookie()

更多選項使用cookie幫手:http://codeigniter.com/user_guide/helpers/cookie_helper.html

+0

我不知道如何查看餅乾的print_r($這個 - >輸入 - >餅乾()) ;請舉個例子嗎? – listratov

+0

是的。如果您知道的cookie名稱中使用這樣的:'的print_r($這個 - >輸入 - >餅乾( 'COOKIE_NAME'));' –