how to config cookie domain in main.php?

is there any way to config CHttpCookie in main.php so that the var domain have some value?

I config main.php in like this.

‘components’ => array(

‘CHttpCookie’=>array(

‘domain’=>’.xxxxx.com’,

),

)

but does not work?

no one knows?

qiang?

This doesn’t work. You have to set the domain when setting the actual cookie.

but in where set the domain?

Something like:




$cookie = new CHttpCookie('test', '123456');

$cookie->domain = '.example.com';


Yii::app()->request->cookies['test'] = $cookie; // will send the cookie



but how to setting domain in CWebUser ?

when use class CWebUser,method login($identity,$duration=0) ,how to config the cookie domain?

See here and here for API details.

See this thread for actual usage.

I looked those topic.I look like have some bug?

I don’t understand. Did you tried it and it doesn’t work? More info please.

I config User with ‘allowAutoLoing’ => true

so I should config only User components or User and Session components?

‘components’ => array(

‘user’ => array(

  'class' => 'application.components.WebUser',


  'allowAutoLogin' => true,


  'identityCookie' => array('domain' => '.xxx.com'),

),

),

‘components’ => array(

‘session’ => array(

  'class' => 'CDbHttpSession',


  'cookieParams' => array('domain' => '.xxx.com'),

),

I config main.php like this,but when in on subdomain logout ,other domains still login

586

login.jpg