Home>Article>PHP Framework> What should I do if thinkphp cannot obtain the session?
thinkphp cannot obtain the session because the cookie valid domain name is not set. The solution is: 1. Open the "cookie.php" file; 2. Set the domain in the configuration to the real top-level domain name of the current project. That’s it.
#The operating environment of this tutorial: Windows 7 system, thinkphp v6 version, Dell G3 computer.
thinkphp What should I do if I cannot get the session?
Thinkphp6.0 cannot obtain the session solution
thinkphp6.0 cannot obtain the session. The reason for this problem is:
The cookie valid domain name is not set.
Solution:
Open \app\(Application)\config\cookie.php and set the domain in the configuration to your current The real top-level domain name of the project needs to be set if there are multiple applications. If there is no setting, the session value cannot be obtained, and the verification code, login, etc. may not be normal.
Recommended learning: "thinkPHP Video Tutorial"
The above is the detailed content of What should I do if thinkphp cannot obtain the session?. For more information, please follow other related articles on the PHP Chinese website!