Can't use ini_set because session is active

2019-06-25 15:58发布

How can I fix this?

Warning: ini_set() [function.ini-set]: A session is active. You cannot change the session module's ini settings at this time in C:\xampp\htdocs******.php on line 3

I already tried using session_destroy(); but I still get the error.

Thanks.

2条回答
冷血范
2楼-- · 2019-06-25 16:18

if you server is configured to auto start sessions, you can try also:

php_flag session.auto_start 0

in your .htaccess file

查看更多
老娘就宠你
3楼-- · 2019-06-25 16:35

use session_start(); after ini_set or @ sign before ini_set: @ini_set

查看更多
登录 后发表回答