thinkphp ways to keep pagination in search state _php instance

Source: Internet
Author: User

For many people who use the thinkphp framework, the use of automatic confronted Kęstutis to change the class, in the paging to maintain the results page search status, but the use of the Thinkphp manual program is not effective.

The solution in the thinkphp manual is:

Page jumps to ensure that the query conditions
foreach ($map as $key => $val) {  
$Page->parameter  . =  "$key =". UrlEncode ($val). &;
}

It can't be used to paste directly. 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 good search conditions $MAP traversal, relatively, the form submitted to the data directly traversal effect better, so the above code can be changed to:

Page jumps to ensure that the query conditions
foreach ($_get as $key => $val) {
//echo $key. $val;
$page->parameter  . =  "$key =" UrlEncode ($val) .&;
}

Problem solving, of course, if your form is submitted by post, traversing the post will do.

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.