0

I am having a weird issue with cookies in CodeIgniter. The problem is I am able to use set_cookie() inside my custom helper, however I am unable to get data from a cookie? I get the following error:

Call to undefined function cookie()

EDIT

Okay I figured out how to fix this problem.

I needed to do the following:

$CI =& get_instance();

$CI->input->cookie('cookie name')

However, I still don't understand why you can set a cookie with using $CI, but you have to use $CI to retrieve it...?

hakre
  • 193,403
  • 52
  • 435
  • 836
jason
  • 1,132
  • 14
  • 32

1 Answers1

1

See this question relating to your question.

It's basically a Singleton Design Pattern that uses a function instead of a static method.

Community
  • 1
  • 1
pila
  • 928
  • 3
  • 11
  • 28