Created
May 2, 2015 06:54
-
-
Save yellowkingdom/609b3d2170e90843d1db to your computer and use it in GitHub Desktop.
PHP:Thinkphp db session,thinkphp框架的session放入数据库
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*在Application/Home/Conf/config.php里面加入如下代码*/ | |
'SESSION_AUTO_START' => true, | |
'SESSION_TABLE'=>'think_session', | |
'SESSION_OPTIONS'=>array( | |
'type'=>'Db', | |
'expire'=>1440 | |
) | |
/*然后在/Thinkphp/Library/Think/目录下面要有Session文件夹(也就是驱动)*/ | |
/*然后打开/Thinkphp/Library/Think/Session/Driver/Db.class.php里面有创建数据库的语句,贴入数据库并运行生成即可*/ | |
/*like below*/ | |
/* | |
* * 数据库方式Session驱动 | |
*/ | |
"CREATE TABLE think_session ( | |
session_id varchar(255) NOT NULL, | |
session_expire int(11) NOT NULL, | |
session_data blob, | |
UNIQUE KEY `session_id` (`session_id`) | |
);" | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment