The bug in the php project that has not been resolved last night was finally solved just now.I also need to thank you for your help!
Specific problem description
Recently encountered a very difficult problem,It's also because I just started thinkphp. During the project,Because very many query conditions are required,If the form is submitted by get,It will report an error because of the url length limitation.Therefore, the form data must be submitted using the post method.But during the paging process,Encountered a problem,Because the pagination that comes with thinkphp is in the form of a tag,Go to the next page,In this way, the query conditions are not passed into the background.When clicking the next page,A blank appears.
Checked the official thinkphp manual,Said that if it is a post query,How to ensure that the original query conditions can be maintained after pagination,The detailed description is shown in the following figure:
But I have a problem with the manual,Since it is paginated by a tag,So how do the parameter values in $map (ie query condition parameters) be transmitted to the background?I also found some other methods online,For example, use $_request to get parameters.It is said that it includes post and get methods.But thinkphp's pagination uses the a tag to pass parameters.The parameters should still not be available,Tried it a few times,It turned out to be a failure.There are other ways,It didn't seem to work.So I asked a question on the blog last night.I was inspired by a great god,Is to modify the href attribute of the a tag with js. This really works,Then I tried all the time,Finally solved the problem.
Among them, selcon is the parameters in the form,For example name="selcon.a", name="selcon.b" ...
According to the method above, when clicking the next page,The query parameter cannot be passed.But I found another problem,In other words, when we enter the second page,Then change the query conditions,The query result does not start from the first one.But from the second page,So we also need to set the p parameter (current page number) to 1 in JS when querying. The specific method is as follows:
- thinkphp5 URL and routing function details and examples
- thinkphp URL routing rules and configuration examples
- Detailed ThinkPHP routing
- ThinkPHP, ZF2, Yaf, Laravel framework routing competition
- Rewrite ThinkPHP's U method to make paging under routing normal
- thinkphp U method to generate URL according to routing rules
- Introduction to ThinkPHP routing mechanism
- I (), U (), $this-> post () and other functions in ThinkPHP
- thinkPHP51 framework routing :: get, post request simple usage example
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- i want to call a child component method from a parent in vuejs
- xcode - pod install [!] no `podfile 'found in the project directory
- dart - flutter: the instance member'stars' can't be accessed in an initializer error