php Sessions not work well without www

前端 未结 3 1738
没有蜡笔的小新
没有蜡笔的小新 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:22

    If you want the php session to work all your subdomains, you must change cookie_domain option. Type this to top of your script:

    ini_set('session.cookie_domain', '.example.com' );
    

提交回复
热议问题