Thinkphp's project, met with a strange thing,
Local Environment Click Login, smoothly into the background;
Virtual space of the site, click Login, unable to enter the background, no error, flash a bit still stay in the login box;
followed, the following statement was also executed:
$this->display (' login ');
Local: The function is then executed:
Public Function login () {
But in virtual space debugging, there is no execution of the above functions. The same database, code, why this? Please advise!
Reply to discussion (solution)
I'm afraid this is not the login thing, and then the context to see
Do you have the code to judge the session in the background? Remove that and see if you can get in.
What is the page jump code after you click login?
Public Function Index () { if (!empty ($_session[c (' Session_admin_name ')]) &&!empty ($_session[c (' Session_ admin_id ')] && strtolower (action_name)! = ' logout ') { $this->redirect ("Index/index"); } $this->display (' login '); /** * Login Judgment * /Public Function login () {
I traced to!empty ($_session[c (' Session_admin_name ')) is true,!empty ($_session[c (' session_admin_id ')]) is also true, resulting in local, Virtual space has execute to statement:
$this->display (' login ');
Wrong, it should be!empty ($_session[c (' Session_admin_name ')) is false,!empty ($_session[c (' session_admin_id ')]) is also false, Is that two sessions are empty.
Remove!empty ($_session[c (' Session_admin_name ')]) &&!empty ($_session[c (' session_admin_id ')]) && statement,
Left:
if (Strtolower (action_name)! = ' logout ') { $this->redirect ("Index/index"); } ... ...
Login page Refresh appears: Page cannot be loaded, this page contains redirect loop
What is the page jump code after you click login?
Thank you for your reply, click the login page to jump to http://.../Login/login.htm
Then immediately jump to http://.../Home/Login/index.htm (login page)
To correct, click on the login page to jump to http://.../Login/login.htm first
And then immediately jump to http://.../Index/index.htm automatically.
And then immediately automatically jump to http://.../Home/Login/index.htm (login page)
$this->display (' main '); } Public Function Main () { $this->display (' center '); }
This $this->display (' center '); ... ...
\manager\lib\action\home\loginaction.class.php
Public Function Logout () { Session_destroy (); CJQ Add $fp = fopen ('./qerr1f.txt ', ' w+ '); Fwrite ($fp, "OK"); Fclose ($FP); $this->redirect (' Login/index '); }
Trace to this code, and did execute to the $this->redirect (' Login/index ');
But I do not know why the local test, also executed to this code, but did not jump to the login page?
Empty the Runtime directory and try Again
If
Public Function logout () {
will be executed to that obviously you're mistaken URL
Logout is logout!
Empty the Runtime directory and try Again
If
Public Function logout () {
will be executed to that obviously you're mistaken URL
Logout is logout!
Thanks a lot! I do not know why logout () will be executed, the three runtime directories are emptied, or the same.
I search the entire station code, only to four paragraphs call logout () of the code, are not related to the login.
Where is the URL mistaken? Got dizzy by the problem!
Empty the Runtime directory and try Again
If
Public Function logout () {
will be executed to that obviously you're mistaken URL
Logout is logout!
Thanks a lot! I don't know why logout () will be called, three runtime directories are emptied, or the same.
Where did the URL go wrong? I'm confused by the problem!
Please open a test page on the virtual machine:
Constantly refresh the test page to see if there is any output time and see if the time is changing.
If time is changing, your server is not configured for session.
Please open a test page on the virtual machine:
Constantly refresh the test page to see if there is any output time and see if the time is changing.
If time is changing, your server is not configured for session.
Thank you for the reply, the time has not changed after the refresh.
Look at the difference between the outputs in the two environments, you can always come out with this kind of clues.
Look at the difference between the outputs in the two environments, you can always come out with this kind of clues.
Both environments output null, really do not understand why ...?