ThinkPHP method for retaining the search status by page _ PHP Tutorial

Source: Internet
Author: User
ThinkPHP allows you to maintain the search status by page. For many users who use the ThinkPHP framework, the query base class should be added, deleted, modified, and deleted automatically, and the search status of the result page should be maintained during paging, however, the solution in the thinkphp manual is used by many people who use the ThinkPHP framework to add, delete, modify, and query the base class automatically. The search status of the result page should be maintained during paging, however, the solution in the thinkphp manual cannot work.

The solution in the ThinkPHP manual is:

// Make sure that the query conditions are foreach ($ map as $ key => $ val) {$ Page-> parameter. = "$ key = ". urlencode ($ val ). &;}

It cannot be used directly. After debugging, you will find that when $ map is not an array, the variable cannot get the desired value, the official idea is to traverse the encapsulated search condition $ map, which is better than directly traversing the data submitted by the form. Therefore, the code above can be changed:

// Make sure that the query conditions are foreach ($ _ GET as $ key => $ val) {// echo $ key. $ val; $ page-> parameter. = "$ key = ". urlencode ($ val ). &;}

Solve the problem. of course, if your form is submitted by POST, just traverse POST.

...

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.