2

我的根目录中的 htaccess 文件中有此代码。

php_value session.gc_maxlifetime 86400
php_value session.cookie_lifetime 86400

但是 PHP 会话不会持续超过几个小时。

4

1 回答 1

5

On a shared web server, when the session.save_path is the common default location, the shortest session.gc_maxlifetime of all the accounts is what gets used to delete the old session data files.

You need to set session.save_path to be to a private folder within your account's folder tree in order to get your session settings to apply to just your session data files.

Create a folder of your own and set the session.save_path to match that folder. You must set the session.save_path before every session_start(). Setting it globally in a local php.ini file would be the best way to set it.

于 2013-09-01T19:34:28.707 回答