php Sessions not work well without www

前端 未结 3 1761
没有蜡笔的小新
没有蜡笔的小新 2021-01-24 09:14

my sessions only work with a sub-domain, e.g. www. ,and do not work without that sub-domain.

For example, when a user is logged in.

If the address is n

3条回答
  •  长发绾君心
    2021-01-24 09:36

    i solved this probem use this code

    session_name("name");
    ini_set ("session.cookie_domain", '.domain.com') ;
    session_set_cookie_params(0, '/', '.domain.com');
    session_start();
    

提交回复
热议问题