Thinkphp's session Cross-domain problem many developers have encountered!
In fact, whether it is thinkphp or PHP itself, in the resolution session Cross-domain problems need to set the Session.cookie_domain.
In thinkphp, you need to modify the configuration file conf/config.php
In the first line, add:
Ini_set (' Session.cookie_domain ', ". domain.com");//cross-domain Access session
After summing up, the solution for the session Cross-domain problem is mainly as follows:
The first case: if you do not have a directory under the htaccess this file, that is, do not take URL pseudo static, then you in the first line of conf/config.php Plus:
Ini_set (' Session.cookie_domain ', ". domain.com");//cross-domain Access session
This can be used if you turn on debugging! But if you turn off debugging, it may not work!
Second: If you have a. htaccess this file, then you add the first line in the root directory, index.php:
<?php ini_set (' Session.cookie_domain ', '. domain.com ');//cross-Domain Access session
//Definition thinkphp Framework path
define (' Think_ PATH ', '/thinkphp/');
Define project name and path
define (' app_name ', ' Www ');
Define (' App_path ', '. ');
Load frame Entry file
require (Think_path.) /thinkphp.php ");
Instantiate a Web application instance
app::run ();
? >
This method will work regardless of whether the debugging is open or not!