Yii Framework Forum: cookies question - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

cookies question Rate Topic: -----

#1 User is offline   harmony 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 24-July 12

Posted 01 August 2012 - 02:11 AM

Hi,

how do I set cookies when the page loads, and have an option of "Don't show this message again"?

Thank you
0

#2 User is offline   kiran sharma 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 492
  • Joined: 21-May 11
  • Location:India

Posted 01 August 2012 - 02:24 AM

you can set cookie as,

Yii::app()->request->cookies['cookie_name'] = new CHttpCookie('cookie_name','Cookie Value')


you can access cookie value in condition or anywhere with,

Yii::app()->request->cookies['cookie_name']->value


to unset cookie use,

unset(Yii::app()->request->cookies['cookie_name']);


View Postharmony, on 01 August 2012 - 02:11 AM, said:

Hi,

how do I set cookies when the page loads, and have an option of "Don't show this message again"?

Thank you

Thanks,
Kiran Sharma.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users