thinkphp Project Background Login problems, strange things

Source: Internet
Author: User
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 ...?
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.