This article mainly introduces the solution to the session cross-domain problem in the ThinkPHP framework. Friends who need it can refer to
ThinkPHP's session cross-domain problem has been encountered by many developers!
In fact, whether it is ThinkPHP or PHP itself, session.cookie_domain needs to be set when solving session cross-domain problems.
In ThinkPHP, you need to modify the configuration file conf/config.php
Add in the first line:
ini_set('session.cookie_domain', ".domain.com");//跨域访问Session
After summary, the main solutions to the problem of session cross-domain are as follows: Type:
The first situation: If there is no .htaccess file in your directory, that is, if the URL is not pseudo-static, then you add: ## to the first line of conf/config.php #
ini_set('session.cookie_domain',".domain.com");//跨域访问Session
thinkPHP5.0 framework overall architecture overview [application, module, MVC, driver, behavior, namespace, etc.]
thinkPHP framework implements the method of generating barcodes
The above is the detailed content of ThinkPHP framework implements session cross-domain issues. For more information, please follow other related articles on the PHP Chinese website!