Thinkphp learn a little mind

Source: Internet
Author: User

1. Loading template times wrong: Class ' Model ' not found file:e:\wamp\www\thinkphp\application\home\model\formmodel.class.php line:7
Solution: Namespace Home\model; Use Think\model; Add a namespace. and must be placed in the first line of the code, or it will be an error and does not work.
Error in New Model () method: $Model = new Model () Hint: Class ' home\controller\model ' not found
Error location: file:e:\wamp\www\kschao\wwwroot\application\home\controller\indexcontroller.class.php line:21
Getlastsql () Error: Hint: Call to a member function Getlastsql () on a non-object
The code is as follows: $student = new Model (' student '); $result = $student->select (); Echo $result->getlastsql ();
Change to $student = new Model (' student '); $result = $student->select (); Echo $student->getlastsql (); OK. The reason is that only the Getlastsql () method can be used on the model

2. Routing
Step1: Open route in project configuration instead of in system configuration
Step2: Set routing Rules routing rules into regular routes and regular routes.

3.php cache?????

3. Empty templates and empty operations

4. Front-and rear-mounted operations
function _before_index ()
function _after_index ()

4. Page jumps and page redirection
Built-in two jump method error and success, respectively for error jump and successful jump. Automatically jumps to the specified address, but the URL address does not change
The built-in Redirect method implements page redirection, which changes the current URL address after redirection.

5. Automatic verification and auto-completion
Auto-Verify: Protected $_validate () =array () Auto-complete: protected $_auto=array ()

Thinkphp learn a little mind

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: 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.