Server: Win2003 + IIS runs normally without problems
Local: Win10 + apache and Win10 + nginx runs normally without problems
The project recently replaced Alibaba Cloud CentOS7.2 and nginx1.10.2; a problem occurred.
There is a Form form in the page for search, and the get data for search. After clicking the button, the following URL is formed
<code>/index.php/User/index.html?key=刘</code>
I use I('key') (TP-encapsulated method of obtaining input variables similar to $_GET['key']) in the controller to obtain this keyword, and then query and paginate; the page number link generates a URL similar to the following
<code>/index.php/User/index/key/刘/p/2.html</code>
When clicking the page number link above to turn the page:
No matter how you get the key locally or from the original server, the key is string "Liu"
But on the new server, the keyword obtained is string "%e5%88%98"
This resulted in all my original programs with this kind of search being ineffective and unable to turn pages.
I('key') uses urldecode when getting the data, but I found that I can only turn one page. If I do it again, the key will be urlencoded again. No matter how many times I turn it, it will be urlencoded infinitely
Since the url pattern cannot be modified, I gave up this method
Win+IIS Win+nginx is no problem. Why does this problem occur when using linux+nginx? Is this the fault of me, Linux, or nginx? Please advise.
We are very urgent to get the project back to normal, please help me with the answers
Server: Win2003 + IIS runs normally without problems
Local: Win10 + apache and Win10 + nginx runs normally without problems
The project recently replaced Alibaba Cloud CentOS7.2 and nginx1.10.2; a problem occurred.
There is a Form form in the page for search, and the get data for search. After clicking the button, the following URL is formed
<code>/index.php/User/index.html?key=刘</code>
I use I('key') (TP-encapsulated method of obtaining input variables similar to $_GET['key']) in the controller to obtain this keyword, and then query and paginate; the page number link generates a URL similar to the following
<code>/index.php/User/index/key/刘/p/2.html</code>
When clicking the page number link above to turn the page:
No matter how you get the key locally or from the original server, the key is string "Liu"
But on the new server, the keyword obtained is string "%e5%88%98"
This resulted in all my original programs with this kind of search being ineffective and unable to turn pages.
I('key') uses urldecode when getting the data, but I found that I can only turn one page. If I do it again, the key will be urlencoded again. No matter how many times I turn it, it will be urlencoded infinitely
Since the url pattern cannot be modified, I gave up this method
Win+IIS Win+nginx is no problem. Why does this problem occur when using linux+nginx? Is this the fault of me, Linux, or nginx? Please advise.
We are very urgent to get the project back to normal, please help me with the answers
In the source code of TP paging, urlencode operation is performed when generating the URL
<code>private function url($page){ return str_replace(urlencode('[PAGE]'), $page, $this->url); }</code>
Solution: You can pass the search parameter as the third parameter when instantiating the paging class. For details, please view the construction method of the Page class