thinkphp How to keep pagination in search _php tutorial

Source: Internet
Author: User
For many people who use the thinkphp framework, the use of automatic and additions and deletions to the Trakai class, when paging to maintain the search status of the results page, but the use of the thinkphp manual in the program is not effective.

The workarounds in the thinkphp manual are:

When paging jumps, guarantee the query condition foreach ($map as $key + $val) {  $Page->parameter  . =  "$key =". UrlEncode ($val). &;}

Paste directly here can not be used, after debugging will find that when $map is not an array, then the variable is not get the desired value, the official idea is to encapsulate the search conditions $map traversal, relative to the form submitted by the data directly traversal effect better, so, the above code can be changed to:

When paging jumps, ensure that the query condition foreach ($_get as $key = = $val) {//echo $key. $val; $page->parameter  . =  "$key =". UrlEncode ( $val). &;}

Problem solved, of course, if your form is post-submitted, traverse the post on the line.

http://www.bkjia.com/PHPjc/824658.html www.bkjia.com true http://www.bkjia.com/PHPjc/824658.html techarticle for many people who use the thinkphp framework, the use of automatic with the additions and deletions to the Trakai class, when paging to maintain the search status of the results page, but the use of thinkphp manual program is ...

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