A problem occurs when new users use the TP framework to instantiate the Model.

Source: Internet
Author: User
A problem occurs when new users use the TP framework to instantiate the Model. 1. A newbie wants to use the TP framework to write a login function. this is the login method in the controller. after the verification code is entered successfully, it enters else, instantiate the Model, and want to query the database.


2. this is the method in the Model. I want to output the content of the query database.


3. Why does one press login when I return to the login interface for debugging? this will prompt me to download the file, and I have not output the query database content? If I don't instantiate the Model, simply echo something in else to echo it.


Reply to discussion (solution)

What is the header output?

What is the header output?



What do you mean. Do you need this?

What is the header output?



I just tried to change it to else {
Echo $ _ POST ['username'];
Echo $ _ POST ['password'];
// $ Login = new \ Home \ Model \ LoginModel ();
// $ Login-> CheckLogin ($ _ POST ['username'], $ _ POST ['password']);

This time, $ _ POST is output directly. Why is output like this?

It should be because the extension of a file is incorrect, and the browser cannot read or parse the file. you can find the login file.

What is the header output?



I commented out the header ("content-type: text/html, charset = utf = 8") in Index. php today ");
Then you can. But I don't know why.

It should be because the extension of a file is incorrect, and the browser cannot read or parse the file. you can find the login file.



I commented out the header ("content-type: text/html, charset = utf = 8") in Index. php today ");
Then you can. But I don't know why.

For breakpoint debugging, you can see where the code is faulty and you cannot see the problem through your code at the moment.


It should be because the extension of a file is incorrect, and the browser cannot read or parse the file. you can find the login file.



I commented out the header ("content-type: text/html, charset = utf = 8") in Index. php today ");
Then you can. But I don't know why.


It's charset = utf8. in your writing, the hyphen equals. you press the-sign into the = sign .....

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.