This article describes how thinkPHP solves the problem of page failure when querying by post. It uses JavaScript to dynamically modify page elements and thinkPHP query statements to solve the problem of page failure, for more information, see the example in this article. thinkPHP uses the post method to solve paging failure. We will share this with you for your reference. The details are as follows:
The bug in the php project that was not solved last night was finally fixed just now. Here, I still need to thank you for your help!
Problem description
I recently encountered a very difficult problem because I just started thinkphp. During project creation, many query conditions are required. If a form is submitted in get mode, an error is reported due to the url length restriction. Therefore, the form data must be submitted in post mode, however, a problem occurs during the paging process, because the page that comes with thinkphp performs the next page in the form of a tag, so that the query conditions are not passed into the background, resulting in when you click the next page, blank.
I checked the official thinkphp manual and explained how to ensure that the original query conditions can be maintained after pagination in case of POST queries. The specific descriptions are as follows:
However, I have some questions about the manual. Since we use the tag for paging, how does the parameter value in $ map (that is, the query condition parameter) be transmitted to the background? I also found some other methods on the Internet, such as getting parameters in the $ _ REQUEST method, that is, passing values in the post and get methods, however, if thinkphp uses the label to PASS Parameters on the page, the parameters still cannot be obtained. After several attempts, the result is indeed a failure. There are other methods that are unreliable. So I asked a question in the blog last night. I was inspired by the idea of using js to modify the href attribute of tag. This is true. Then I tried and finally solved the problem.
Solution:
......
..............
{$ Page}
......