Home>Article>PHP Framework> What should I do if thinkphp cannot obtain the session?

What should I do if thinkphp cannot obtain the session?

藏色散人
藏色散人 Original
2022-12-05 10:02:27 2216browse

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.

What should I do if thinkphp cannot obtain the session?

#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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn